Who is this article for?
CrashPlan for Small Business, no.
Code42 for Enterprise, yes.
Link: Product plans and features.
This article applies to version 6.
This article describes how to upgrade a PostgreSQL server on a Red Hat Enterprise Linux system.
- These instructions describe upgrading PostgreSQL 9.5 to PostgreSQL 9.6 on an RHEL 7.5 system. Precise steps for other environments may differ.
- To upgrade PostgreSQL, you need to know:
- The name and password for the PostgreSQL database that serves your Code42 authority server.
- The name and password for the user who owns that database.
Information about products from other manufacturers is intended as a resource to help you get the most out of Code42 products. However, our Customer Champions cannot provide direct assistance for these products. Contact your Customer Success Manager (CSM) at email@example.com, or the product's manufacturer.
Step 1: Stop your Code42 authority server
- Sign in to the operating system where your Code42 authority server runs.
Use an identity with sudo privileges.
- Stop the authority server with this command:
sudo /etc/init.d/proserver stop
Step 2: Install a new PostgreSQL version
- Learn the current version of your PostgreSQL server with these commands:
$ sudo -i -u postgres $ psql -d <databaseName> # SHOW server_version; # \q $ su <yourLinuxUserName>
- With a web browser, go to the PostgreSQL download web page and select:
- a newer PostgreSQL version
- your Red Hat Enterprise Linux version
- your architecture: x86_64 or ppc64le
- Copy the commands from the web page and execute them at your authority server's operating system. For example:
$ sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm $ sudo yum install postgresql96 $ sudo yum install postgresql96-server $ sudo yum install postgresql96-contrib $ sudo /usr/pgsql-96/bin/postgresql-96-setup initdb
Step 3: Duplicate existing PostgreSQL configuration
- Whatever custom configuration was made at the old PostgreSQL version, you need to duplicate it in the new version. Two files in particular have configuration data:
- In /var/lib/pgsql/9.5/data/postgresql.conf, look for
- In /var/lib/pgsql/9.5/data/pg_hba.conf, look for
/var/lib/pgsql/9.5/data/postgresql.conf listen_addresses = 'localhost,127.0.0.1,<serverIPaddress>' max_connections = ... /var/lib/pgsql/9.5/data/pg_hba.conf host <databaseName> <databaseUser> <serverIPaddress>/32 passwordDo not simply overwrite the new config files with the old ones
New configuration files may include parameters that the old files do not. Overwriting the new files with your old ones will deprive the new server of those new parameters. Instead, compare the old and new configuration files, and edit the new files to duplicate the old custom values.
- In /var/lib/pgsql/9.5/data/postgresql.conf, look for
- Verify configuration with the commands shown in the example below.
The PostgreSQL upgrade script provides a --check parameter that will test for errors. If that command returns *Clusters are compatible* your environment is ready to upgrade.
$ sudo service postgresql-9.5 stop $ sudo -i -u postgres $ /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.5/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.5/data/ --new-datadir=/var/lib/pgsql/9.6/data/ --check *Clusters are compatible*
Step 4: Upgrade, start, verify PostgreSQL
- Upgrade your PostgreSQL server with the command below.
Use the same command as in the previous step, without the --check parameter.
$ /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.5/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.5/data/ --new-datadir=/var/lib/pgsql/9.6/data/ $ su <yourLinuxUserName>
The upgrade command should return this message:
Upgrade Complete ---------------- Optimizer statistics are not transferred by pg_upgrade so, once you start the new server, consider running: ./analyze_new_cluster.sh Running this script will delete the old cluster's data files: ./delete_old_cluster.sh
- Start the new PostgreSQL server with commands like the following:
$ sudo systemctl enable postgresql-9.6 Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service to /usr/lib/systemd/system/postgresql-9.6.service $ sudo systemctl start postgresql-9.6 $ sudo systemctl status postgresql-9.6
- Verify that the new PostgreSQL server is running. Use commands like these:
$ sudo -i -u postgres $ /var/lib/pgsql/analyze_new_cluster.sh $ psql -d <databaseName> # SHOW server_version; # \q $ su <yourLinuxUserName>
Step 5. Restart and verify your authority server
If your Code42 authority server fails to start or work with the new database, seek help from your Code42 Customer Success Manager (CSM), firstname.lastname@example.org.
- Restart your Code42 authority server with this command:
sudo /etc/init.d/proserver start
- Sign in to your administration console.
- Click on the Code42 logo in the upper-left.
- In console's command line, issue this command:
db.server statusThe reply should read:
Your server is configured for PostgreSQL
- In the administration console, select Administration > Organizations > Active.
If the list does not show all of your active organizations, seek help from your Code42 Customer Success Manager (CSM) at email@example.com.
- Click on one of the organization names.
The organization details display. If the details do not accurately describe the organization, seek help from your Code42 Customer Success Manager (CSM), firstname.lastname@example.org.
Step 6. Verify your database monitoring and backup
The programs you use to monitor and back up your database are outside the scope of this article or Code42 support.
Verify that those monitoring and back up programs continue to operate on the new database without error.
Step 7: Clean up
When you are confident of the new PostgreSQL server, you can delete the old database. The following command removes the directory /var/lib/pgsql/9.5/data.
$ sudo /var/lib/pgsql/delete_old_cluster.sh