Questo contenuto non è disponibile nella lingua selezionata.

Chapter 5. Migration


This chapter provides information on migrating to versions of components included in Red Hat Software Collections 3.1.

5.1. Migrating to MariaDB 10.2

Red Hat Enterprise Linux 6 contains MySQL 5.1 as the default MySQL implementation. Red Hat Enterprise Linux 7 includes MariaDB 5.5 as the default MySQL implementation. MariaDB is a community-developed drop-in replacement for MySQL. MariaDB 10.1 has been available as a Software Collection since Red Hat Software Collections 2.2; Red Hat Software Collections 3.1 is distributed with MariaDB 10.2.
The rh-mariadb102 Software Collection, available for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7, does not conflict with the mysql or mariadb packages from the core systems, so it is possible to install the rh-mariadb102 Software Collection together with the mysql or mariadb packages. It is also possible to run both versions at the same time, however, the port number and the socket in the my.cnf files need to be changed to prevent these specific resources from conflicting. Additionally, it is possible to install the rh-mariadb102 Software Collection while the rh-mariadb101 Collection is still installed and even running.
Note that if you are using MariaDB 5.5 or MariaDB 10.0, it is necessary to upgrade to the rh-mariadb101 Software Collection first, which is described in the Red Hat Software Collections 2.4 Release Notes.
For more information about MariaDB 10.2, see the upstream documentation about changes in version 10.2 and about upgrading.

Note

The rh-mariadb102 Software Collection supports neither mounting over NFS nor dynamical registering using the scl register command.

5.1.1. Notable Differences Between the rh-mariadb101 and rh-mariadb102 Software Collections

Major changes in MariaDB 10.2 are described in the Red Hat Software Collections 3.0 Release Notes.
Since MariaDB 10.2, behavior of the SQL_MODE variable has been changed; see the upstream documentation for details.
Multiple options have changed their default values or have been deprecated or removed. For details, see the Knowledgebase article Migrating from MariaDB 10.1 to the MariaDB 10.2 Software Collection.
The rh-mariadb102 Software Collection includes the rh-mariadb102-syspaths package, which installs packages that provide system-wide wrappers for binaries, scripts, manual pages, and other. After installing the rh-mariadb102*-syspaths packages, users are not required to use the scl enable command for correct functioning of the binaries and scripts provided by the rh-mariadb102* packages. Note that the *-syspaths packages conflict with the corresponding packages from the base Red Hat Enterprise Linux system.

5.1.2. Upgrading from the rh-mariadb101 to the rh-mariadb102 Software Collection

Important

Prior to upgrading, back up all your data, including any MariaDB databases.
  1. Stop the rh-mariadb101 database server if it is still running.
    Before stopping the server, set the innodb_fast_shutdown option to 0, so that InnoDB performs a slow shutdown, including a full purge and insert buffer merge. Read more about this option in the upstream documentation. This operation can take a longer time than in case of a normal shutdown.
    mysql -uroot -p -e "SET GLOBAL innodb_fast_shutdown = 0"
    Stop the rh-mariadb101 server.
    service rh-mariadb101-mariadb stop
  2. Install the rh-mariadb102 Software Collection.
    yum install rh-mariadb102-mariadb-server
    Note that it is possible to install the rh-mariadb102 Software Collection while the rh-mariadb101 Software Collection is still installed because these Collections do not conflict.
  3. Inspect configuration of rh-mariadb102, which is stored in the /etc/opt/rh/rh-mariadb102/my.cnf file and the /etc/opt/rh/rh-mariadb102/my.cnf.d/ directory. Compare it with configuration of rh-mariadb101 stored in /etc/opt/rh/rh-mariadb101/my.cnf and /etc/opt/rh/rh-mariadb101/my.cnf.d/ and adjust it if necessary.
  4. All data of the rh-mariadb101 Software Collection is stored in the /var/opt/rh/rh-mariadb101/lib/mysql/ directory unless configured differently. Copy the whole content of this directory to /var/opt/rh/rh-mariadb102/lib/mysql/. You can move the content but remember to back up your data before you continue to upgrade. Make sure the data are owned by the mysql user and SELinux context is correct.
  5. Start the rh-mariadb102 database server.
    service rh-mariadb102-mariadb start
  6. Perform the data migration.
    scl enable rh-mariadb102 mysql_upgrade
    If the root user has a non-empty password defined (it should have a password defined), it is necessary to call the mysql_upgrade utility with the -p option and specify the password.
    scl enable rh-mariadb102 -- mysql_upgrade -p

5.2. Migrating to MongoDB 3.6

Red Hat Software Collections 3.1 is released with MongoDB 3.6, provided by the rh-mongodb36 Software Collection and available only for Red Hat Enterprise Linux 7.
The rh-mongodb36 Software Collection includes the rh-mongodb36-syspaths package, which installs packages that provide system-wide wrappers for binaries, scripts, manual pages, and other. After installing the rh-mongodb36*-syspaths packages, users are not required to use the scl enable command for correct functioning of the binaries and scripts provided by the rh-mongodb36* packages. To find out more about syspaths, see the Red Hat Software Collections Packaging Guide.

5.2.1. Notable Differences Between MongoDB 3.4 and MongoDB 3.6

General Changes

The rh-mongodb36 Software Collection introduces the following significant general change:
  • On Non-Uniform Access Memory (NUMA) hardware, it is possible to configure systemd services to be launched using the numactl command; see the upstream recommendation. To use MongoDB with the numactl command, you need to install the numactl RPM package and change the /etc/opt/rh/rh-mongodb36/sysconfig/mongod and /etc/opt/rh/rh-mongodb36/sysconfig/mongos configuration files accordingly.

Compatibility Changes

MongoDB 3.6 includes various minor changes that can affect compatibility with previous versions of MongoDB:
  • MongoDB binaries now bind to localhost by default, so listening on different IP addresses needs to be explicitly enabled. Note that this is already the default behavior for systemd services distributed with MongoDB Software Collections.
  • The MONGODB-CR authentication mechanism has been deprecated. For databases with users created by MongoDB versions earlier than 3.0, upgrade authentication schema to SCRAM.
  • The HTTP interface and REST API have been removed
  • Arbiters in replica sets have priority 0
  • Master-slave replication has been deprecated
For detailed compatibility changes in MongoDB 3.6, see the upstream release notes.

Backwards Incompatible Features

The following MongoDB 3.6 features are backwards incompatible and require the version to be set to 3.6 using the featureCompatibilityVersion command:
  • UUID for collections
  • $jsonSchema document validation
  • Change streams
  • Chunk aware secondaries
  • View definitions, document validators, and partial index filters that use version 3.6 query features
  • Sessions and retryable writes
  • Users and roles with authenticationRestrictions
For details regarding backward incompatible changes in MongoDB 3.6, see the upstream release notes.

5.2.2. Upgrading from the rh-mongodb34 to the rh-mongodb36 Software Collection

Important

Before migrating from the rh-mongodb34 to the rh-mongodb36 Software Collection, back up all your data, including any MongoDB databases, which are by default stored in the /var/opt/rh/rh-mongodb34/lib/mongodb/ directory. In addition, see the Compatibility Changes to ensure that your applications and deployments are compatible with MongoDB 3.6.
To upgrade to the rh-mongodb36 Software Collection, perform the following steps.
  1. To be able to upgrade, the rh-mongodb34 instance must have featureCompatibilityVersion set to 3.4. Check featureCompatibilityVersion:
    ~]$ scl enable rh-mongodb34 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})'
    If the mongod server is configured with enabled access control, add the --username and --password options to the mongo command.
  2. Install the MongoDB servers and shells from the rh-mongodb36 Software Collections:
    ~]# yum install rh-mongodb36
  3. Stop the MongoDB 3.4 server:
    ~]# systemctl stop rh-mongodb34-mongod.service
  4. Copy your data to the new location:
    ~]# cp -a /var/opt/rh/rh-mongodb34/lib/mongodb/* /var/opt/rh/rh-mongodb36/lib/mongodb/
  5. Configure the rh-mongodb36-mongod daemon in the /etc/opt/rh/rh-mongodb36/mongod.conf file.
  6. Start the MongoDB 3.6 server:
    ~]# systemctl start rh-mongodb36-mongod.service
  7. Enable backwards incompatible features:
    ~]$ scl enable rh-mongodb36 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )'
    If the mongod server is configured with enabled access control, add the --username and --password options to the mongo command.

    Note

    After upgrading, it is recommended to run the deployment first without enabling the backwards incompatible features for a burn-in period of time, to minimize the likelihood of a downgrade.
For detailed information about upgrading, see the upstream release notes.
For information about upgrading a Replica Set, see the upstream MongoDB Manual.
For information about upgrading a Sharded Cluster, see the upstream MongoDB Manual.

5.3. Migrating to MongoDB 3.4

The rh-mongodb34 Software Collection, available for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7, provides MongoDB 3.4.

5.3.1. Notable Differences Between MongoDB 3.2 and MongoDB 3.4

General Changes

The rh-mongodb34 Software Collection introduces various general changes. Major changes are listed in the Knowledgebase article Migrating from MongoDB 3.2 to MongoDB 3.4. For detailed changes, see the upstream release notes.
In addition, this Software Collection includes the rh-mongodb34-syspaths package, which installs packages that provide system-wide wrappers for binaries, scripts, manual pages, and other. After installing the rh-mongodb34*-syspaths packages, users are not required to use the scl enable command for correct functioning of the binaries and scripts provided by the rh-mongodb34* packages. To find out more about syspaths, see the Red Hat Software Collections Packaging Guide.

Compatibility Changes

MongoDB 3.4 includes various minor changes that can affect compatibility with previous versions of MongoDB. For details, see the Knowledgebase article Migrating from MongoDB 3.2 to MongoDB 3.4 and the upstream documentation.
Notably, the following MongoDB 3.4 features are backwards incompatible and require that the version is set to 3.4 using the featureCompatibilityVersion command:
  • Support for creating read-only views from existing collections or other views
  • Index version v: 2, which adds support for collation, decimal data and case-insensitive indexes
  • Support for the decimal128 format with the new decimal data type
For details regarding backward incompatible changes in MongoDB 3.4, see the upstream release notes.

5.3.2. Upgrading from the rh-mongodb32 to the rh-mongodb34 Software Collection

Note that once you have upgraded to MongoDB 3.4 and started using new features, cannot downgrade to version 3.2.7 or earlier. You can only downgrade to version 3.2.8 or later.

Important

Before migrating from the rh-mongodb32 to the rh-mongodb34 Software Collection, back up all your data, including any MongoDB databases, which are by default stored in the /var/opt/rh/rh-mongodb32/lib/mongodb/ directory. In addition, see the compatibility changes to ensure that your applications and deployments are compatible with MongoDB 3.4.
To upgrade to the rh-mongodb34 Software Collection, perform the following steps.
  1. Install the MongoDB servers and shells from the rh-mongodb34 Software Collections:
    ~]# yum install rh-mongodb34
  2. Stop the MongoDB 3.2 server:
    ~]# systemctl stop rh-mongodb32-mongod.service
    Use the service rh-mongodb32-mongodb stop command on a Red Hat Enterprise Linux 6 system.
  3. Copy your data to the new location:
    ~]# cp -a /var/opt/rh/rh-mongodb32/lib/mongodb/* /var/opt/rh/rh-mongodb34/lib/mongodb/
  4. Configure the rh-mongodb34-mongod daemon in the /etc/opt/rh/rh-mongodb34/mongod.conf file.
  5. Start the MongoDB 3.4 server:
    ~]# systemctl start rh-mongodb34-mongod.service
    On Red Hat Enterprise Linux 6, use the service rh-mongodb34-mongodb start command instead.
  6. Enable backwards-incompatible features:
    ~]$ scl enable rh-mongodb34 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )'
    If the mongod server is configured with enabled access control, add the --username and --password options to mongo command.
    Note that it is recommended to run the deployment after the upgrade without enabling these features first.
For detailed information about upgrading, see the upstream release notes.
For information about upgrading a Replica Set, see the upstream MongoDB Manual.
For information about upgrading a Sharded Cluster, see the upstream MongoDB Manual.

5.4. Migrating to MySQL 5.7

Red Hat Enterprise Linux 6 contains MySQL 5.1 as the default MySQL implementation. Red Hat Enterprise Linux 7 includes MariaDB 5.5 as the default MySQL implementation. In addition to these basic versions, MySQL 5.6 has been available as a Software Collection for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7 since Red Hat Software Collections 2.0.
The rh-mysql57 Software Collection, available for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7, conflicts neither with the mysql or mariadb packages from the core systems nor with the rh-mysql56 Software Collection, so it is possible to install the rh-mysql57 Software Collection together with the mysql, mariadb, or rh-mysql56 packages. It is also possible to run multiple versions at the same time; however, the port number and the socket in the my.cnf files need to be changed to prevent these specific resources from conflicting.
Note that it is possible to upgrade to MySQL 5.7 only from MySQL 5.6. If you need to upgrade from an earlier version, upgrade to MySQL 5.6 first. Instructions how to upgrade to MySQL 5.6 are available in the Red Hat Software Collections 2.2 Release Notes.

5.4.1. Notable Differences Between MySQL 5.6 and MySQL 5.7

  • The mysql-bench subpackage is not included in the rh-mysql57 Software Collection.
  • Since MySQL 5.7.7, the default SQL mode includes NO_AUTO_CREATE_USER. Therefore it is necessary to create MySQL accounts using the CREATE USER statement because the GRANT statement no longer creates a user by default. See the upstream documentation for details.
To find out about more detailed changes in MySQL 5.7 compared to earlier versions, see the upstream documentation: What Is New in MySQL 5.7 and Changes Affecting Upgrades to MySQL 5.7.

5.4.2. Upgrading to the rh-mysql57 Software Collection

Important

Prior to upgrading, back-up all your data, including any MySQL databases.
  1. Install the rh-mysql57 Software Collection.
    yum install rh-mysql57-mysql-server
  2. Inspect the configuration of rh-mysql57, which is stored in the /etc/opt/rh/rh-mysql57/my.cnf file and the /etc/opt/rh/rh-mysql57/my.cnf.d/ directory. Compare it with the configuration of rh-mysql56 stored in /etc/opt/rh/rh-mysql56/my.cnf and /etc/opt/rh/rh-mysql56/my.cnf.d/ and adjust it if necessary.
  3. Stop the rh-mysql56 database server, if it is still running.
    service rh-mysql56-mysqld stop
  4. All data of the rh-mysql56 Software Collection is stored in the /var/opt/rh/rh-mysql56/lib/mysql/ directory. Copy the whole content of this directory to /var/opt/rh/rh-mysql57/lib/mysql/. You can also move the content but remember to back up your data before you continue to upgrade.
  5. Start the rh-mysql57 database server.
    service rh-mysql57-mysqld start
  6. Perform the data migration.
    scl enable rh-mysql57 mysql_upgrade
    If the root user has a non-empty password defined (it should have a password defined), it is necessary to call the mysql_upgrade utility with the -p option and specify the password.
    scl enable rh-mysql57 -- mysql_upgrade -p

5.5. Migrating to PostgreSQL 10

Red Hat Software Collections 3.1 is distributed with PostgreSQL 10, available only for Red Hat Enterprise Linux 7. The rh-postgresql10 Software Collection can be safely installed on the same machine in parallel with the base Red Hat Enterprise Linux system version of PostgreSQL or any PostgreSQL Software Collection. It is also possible to run more than one version of PostgreSQL on a machine at the same time, but you need to use different ports or IP addresses and adjust SELinux policy. See Section 5.6, “Migrating to PostgreSQL 9.6” for instructions how to migrate to an earlier version or when using Red Hat Enterprise Linux 6.
The rh-postgresql10 Software Collection includes the rh-postgresql10-syspaths package, which installs packages that provide system-wide wrappers for binaries, scripts, manual pages, and other. After installing the rh-postgreqsl10*-syspaths packages, users are not required to use the scl enable command for correct functioning of the binaries and scripts provided by the rh-postgreqsl10* packages. Note that the *-syspaths packages conflict with the corresponding packages from the base Red Hat Enterprise Linux system. To find out more about syspaths, see the Red Hat Software Collections Packaging Guide.

Important

Before migrating to PostgreSQL 10, see the upstream compatibility notes.
The following table provides an overview of different paths in a Red Hat Enterprise Linux 7 system version of PostgreSQL provided by the postgresql package, and in the rh-postgresql96 and rh-postgresql10 Software Colections.
Table 5.1. Diferences in the PostgreSQL paths
Contentpostgresqlrh-postgresql96rh-postgresql10
Executables/usr/bin//opt/rh/rh-postgresql96/root/usr/bin//opt/rh/rh-postgresql10/root/usr/bin/
Libraries/usr/lib64//opt/rh/rh-postgresql96/root/usr/lib64//opt/rh/rh-postgresql10/root/usr/lib64/
Documentation/usr/share/doc/postgresql/html//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql/html//opt/rh/rh-postgresql10/root/usr/share/doc/postgresql/html/
PDF documentation/usr/share/doc/postgresql-docs//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql-docs//opt/rh/rh-postgresql10/root/usr/share/doc/postgresql-docs/
Contrib documentation/usr/share/doc/postgresql-contrib//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql-contrib//opt/rh/rh-postgresql10/root/usr/share/doc/postgresql-contrib/
Sourcenot installednot installednot installed
Data/var/lib/pgsql/data//var/opt/rh/rh-postgresql96/lib/pgsql/data//var/opt/rh/rh-postgresql10/lib/pgsql/data/
Backup area/var/lib/pgsql/backups//var/opt/rh/rh-postgresql96/lib/pgsql/backups//var/opt/rh/rh-postgresql10/lib/pgsql/backups/
Templates/usr/share/pgsql//opt/rh/rh-postgresql96/root/usr/share/pgsql//opt/rh/rh-postgresql10/root/usr/share/pgsql/
Procedural Languages/usr/lib64/pgsql//opt/rh/rh-postgresql96/root/usr/lib64/pgsql//opt/rh/rh-postgresql10/root/usr/lib64/pgsql/
Development Headers/usr/include/pgsql//opt/rh/rh-postgresql96/root/usr/include/pgsql//opt/rh/rh-postgresql10/root/usr/include/pgsql/
Other shared data/usr/share/pgsql//opt/rh/rh-postgresql96/root/usr/share/pgsql//opt/rh/rh-postgresql10/root/usr/share/pgsql/
Regression tests/usr/lib64/pgsql/test/regress/ (in the -test package)/opt/rh/rh-postgresql96/root/usr/lib64/pgsql/test/regress/ (in the -test package)/opt/rh/rh-postgresql10/root/usr/lib64/pgsql/test/regress/ (in the -test package)

5.5.1. Migrating from a Red Hat Enterprise Linux System Version of PostgreSQL to the PostgreSQL 10 Software Collection

Red Hat Enterprise Linux 7 is distributed with PostgreSQL 9.2. To migrate your data from a Red Hat Enterprise Linux system version of PostgreSQL to the rh-postgresql10 Software Collection, you can either perform a fast upgrade using the pg_upgrade tool (recommended), or dump the database data into a text file with SQL commands and import it in the new database. Note that the second method is usually significantly slower and may require manual fixes; see the PostgreSQL documentation for more information about this upgrade method.

Important

Before migrating your data from a Red Hat Enterprise Linux system version of PostgreSQL to PostgreSQL 10, make sure that you back up all your data, including the PostgreSQL database files, which are by default located in the /var/lib/pgsql/data/ directory.

Procedure 5.1. Fast Upgrade Using the pg_upgrade Tool

To perform a fast upgrade of your PostgreSQL server, complete the following steps:
  1. Stop the old PostgreSQL server to ensure that the data is not in an inconsistent state. To do so, type the following at a shell prompt as root:
    systemctl stop postgresql.service
    To verify that the server is not running, type:
    systemctl status postgresql.service
  2. Verify that the old directory /var/lib/pgsql/data/ exists:
    file /var/lib/pgsql/data/
    and back up your data.
  3. Verify that the new data directory /var/opt/rh/rh-postgresql10/lib/pgsql/data/ does not exist:
    file /var/opt/rh/rh-postgresql10/lib/pgsql/data/
    If you are running a fresh installation of PostgreSQL 10, this directory should not be present in your system. If it is, back it up by running the following command as root:
    mv /var/opt/rh/rh-postgresql10/lib/pgsql/data{,-scl-backup}
  4. Upgrade the database data for the new server by running the following command as root:
    scl enable rh-postgresql10 -- postgresql-setup --upgrade
    Alternatively, you can use the /opt/rh/rh-postgresql10/root/usr/bin/postgresql-setup --upgrade command.
    Note that you can use the --upgrade-from option for upgrade from different versions of PostgreSQL. The list of possible upgrade scenarios is available using the --upgrade-ids option.
    It is recommended that you read the resulting /var/lib/pgsql/upgrade_rh-postgresql10-postgresql.log log file to find out if any problems occurred during the upgrade.
  5. Start the new server as root:
    systemctl start rh-postgresql10-postgresql.service
    It is also advised that you run the analyze_new_cluster.sh script as follows:
    su - postgres -c 'scl enable rh-postgresql10 ~/analyze_new_cluster.sh'
  6. Optionally, you can configure the PostgreSQL 10 server to start automatically at boot time. To disable the old system PostgreSQL server, type the following command as root:
    chkconfig postgresql off
    To enable the PostgreSQL 10 server, type as root:
    chkconfig rh-postgresql10-postgresql on
  7. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql10/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

Procedure 5.2. Performing a Dump and Restore Upgrade

To perform a dump and restore upgrade of your PostgreSQL server, complete the following steps:
  1. Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as root:
    systemctl start postgresql.service
  2. Dump all data in the PostgreSQL database into a script file. As root, type:
    su - postgres -c 'pg_dumpall > ~/pgdump_file.sql'
  3. Stop the old server by running the following command as root:
    systemctl stop postgresql.service
  4. Initialize the data directory for the new server as root:
    scl enable rh-postgresql10-postgresql -- postgresql-setup --initdb
  5. Start the new server as root:
    systemctl start rh-postgresql10-postgresql.service
  6. Import data from the previously created SQL file:
    su - postgres -c 'scl enable rh-postgresql10 "psql -f ~/pgdump_file.sql postgres"'
  7. Optionally, you can configure the PostgreSQL 10 server to start automatically at boot time. To disable the old system PostgreSQL server, type the following command as root:
    chkconfig postgresql off
    To enable the PostgreSQL 10 server, type as root:
    chkconfig rh-postgresql10-postgresql on
  8. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql10/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

5.5.2. Migrating from the PostgreSQL 9.6 Software Collection to the PostgreSQL 10 Software Collection

To migrate your data from the rh-postgresql96 Software Collection to the rh-postgresql10 Collection, you can either perform a fast upgrade using the pg_upgrade tool (recommended), or dump the database data into a text file with SQL commands and import it in the new database. Note that the second method is usually significantly slower and may require manual fixes; see the PostgreSQL documentation for more information about this upgrade method.

Important

Before migrating your data from PostgreSQL 9.6 to PostgreSQL 10, make sure that you back up all your data, including the PostgreSQL database files, which are by default located in the /var/opt/rh/rh-postgresql96/lib/pgsql/data/ directory.

Procedure 5.3. Fast Upgrade Using the pg_upgrade Tool

To perform a fast upgrade of your PostgreSQL server, complete the following steps:
  1. Stop the old PostgreSQL server to ensure that the data is not in an inconsistent state. To do so, type the following at a shell prompt as root:
    systemctl stop rh-postgresql96-postgresql.service
    To verify that the server is not running, type:
    systemctl status rh-postgresql96-postgresql.service
  2. Verify that the old directory /var/opt/rh/rh-postgresql96/lib/pgsql/data/ exists:
    file /var/opt/rh/rh-postgresql96/lib/pgsql/data/
    and back up your data.
  3. Verify that the new data directory /var/opt/rh/rh-postgresql10/lib/pgsql/data/ does not exist:
    file /var/opt/rh/rh-postgresql10/lib/pgsql/data/
    If you are running a fresh installation of PostgreSQL 10, this directory should not be present in your system. If it is, back it up by running the following command as root:
    mv /var/opt/rh/rh-postgresql10/lib/pgsql/data{,-scl-backup}
  4. Upgrade the database data for the new server by running the following command as root:
    scl enable rh-postgresql10 -- postgresql-setup --upgrade --upgrade-from=rh-postgresql96-postgresql
    Alternatively, you can use the /opt/rh/rh-postgresql10/root/usr/bin/postgresql-setup --upgrade --upgrade-from=rh-postgresql96-postgresql command.
    Note that you can use the --upgrade-from option for upgrading from different versions of PostgreSQL. The list of possible upgrade scenarios is available using the --upgrade-ids option.
    It is recommended that you read the resulting /var/lib/pgsql/upgrade_rh-postgresql10-postgresql.log log file to find out if any problems occurred during the upgrade.
  5. Start the new server as root:
    systemctl start rh-postgresql10-postgresql.service
    It is also advised that you run the analyze_new_cluster.sh script as follows:
    su - postgres -c 'scl enable rh-postgresql10 ~/analyze_new_cluster.sh'
  6. Optionally, you can configure the PostgreSQL 10 server to start automatically at boot time. To disable the old PostgreSQL 9.6 server, type the following command as root:
    chkconfig rh-postgresql96-postgreqsql off
    To enable the PostgreSQL 10 server, type as root:
    chkconfig rh-postgresql10-postgresql on
  7. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql10/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

Procedure 5.4. Performing a Dump and Restore Upgrade

To perform a dump and restore upgrade of your PostgreSQL server, complete the following steps:
  1. Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as root:
    systemctl start rh-postgresql96-postgresql.service
  2. Dump all data in the PostgreSQL database into a script file. As root, type:
    su - postgres -c 'scl enable rh-postgresql96 "pg_dumpall > ~/pgdump_file.sql"'
  3. Stop the old server by running the following command as root:
    systemctl stop rh-postgresql96-postgresql.service
  4. Initialize the data directory for the new server as root:
    scl enable rh-postgresql10-postgresql -- postgresql-setup --initdb
  5. Start the new server as root:
    systemctl start rh-postgresql10-postgresql.service
  6. Import data from the previously created SQL file:
    su - postgres -c 'scl enable rh-postgresql10 "psql -f ~/pgdump_file.sql postgres"'
  7. Optionally, you can configure the PostgreSQL 10 server to start automatically at boot time. To disable the old PostgreSQL 9.6 server, type the following command as root:
    chkconfig rh-postgresql96-postgresql off
    To enable the PostgreSQL 10 server, type as root:
    chkconfig rh-postgresql10-postgresql on
  8. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql10/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

5.6. Migrating to PostgreSQL 9.6

PostgreSQL 9.6 is available for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7 and it can be safely installed on the same machine in parallel with PostgreSQL 8.4 from Red Hat Enterprise Linux 6, PostgreSQL 9.2 from Red Hat Enterprise Linux 7, or any version of PostgreSQL released in previous versions of Red Hat Software Collections. It is also possible to run more than one version of PostgreSQL on a machine at the same time, but you need to use different ports or IP addresses and adjust SELinux policy.

5.6.1. Notable Differences Between PostgreSQL 9.5 and PostgreSQL 9.6

The most notable changes between PostgreSQL 9.5 and PostgreSQL 9.6 are described in the upstream release notes.
The rh-postgresql96 Software Collection includes the rh-postgresql96-syspaths package, which installs packages that provide system-wide wrappers for binaries, scripts, manual pages, and other. After installing the rh-postgreqsl96*-syspaths packages, users are not required to use the scl enable command for correct functioning of the binaries and scripts provided by the rh-postgreqsl96* packages. Note that the *-syspaths packages conflict with the corresponding packages from the base Red Hat Enterprise Linux system. To find out more about syspaths, see the Red Hat Software Collections Packaging Guide.
The following table provides an overview of different paths in a Red Hat Enterprise Linux system version of PostgreSQL (postgresql) and in the postgresql92, rh-postgresql95, and rh-postgresql96 Software Collections. Note that the paths of PostgreSQL 8.4 distributed with Red Hat Enterprise Linux 6 and the system version of PostgreSQL 9.2 shipped with Red Hat Enterprise Linux 7 are the same; the paths for the rh-postgresql94 Software Collection are analogous to rh-postgresql95.
Table 5.2. Diferences in the PostgreSQL paths
Contentpostgresqlpostgresql92rh-postgresql95rh-postgresql96
Executables/usr/bin//opt/rh/postgresql92/root/usr/bin//opt/rh/rh-postgresql95/root/usr/bin//opt/rh/rh-postgresql96/root/usr/bin/
Libraries/usr/lib64//opt/rh/postgresql92/root/usr/lib64//opt/rh/rh-postgresql95/root/usr/lib64//opt/rh/rh-postgresql96/root/usr/lib64/
Documentation/usr/share/doc/postgresql/html//opt/rh/postgresql92/root/usr/share/doc/postgresql/html//opt/rh/rh-postgresql95/root/usr/share/doc/postgresql/html//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql/html/
PDF documentation/usr/share/doc/postgresql-docs//opt/rh/postgresql92/root/usr/share/doc/postgresql-docs//opt/rh/rh-postgresql95/root/usr/share/doc/postgresql-docs//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql-docs/
Contrib documentation/usr/share/doc/postgresql-contrib//opt/rh/postgresql92/root/usr/share/doc/postgresql-contrib//opt/rh/rh-postgresql95/root/usr/share/doc/postgresql-contrib//opt/rh/rh-postgresql96/root/usr/share/doc/postgresql-contrib/
Sourcenot installednot installednot installednot installed
Data/var/lib/pgsql/data//opt/rh/postgresql92/root/var/lib/pgsql/data//var/opt/rh/rh-postgresql95/lib/pgsql/data//var/opt/rh/rh-postgresql96/lib/pgsql/data/
Backup area/var/lib/pgsql/backups//opt/rh/postgresql92/root/var/lib/pgsql/backups//var/opt/rh/rh-postgresql95/lib/pgsql/backups//var/opt/rh/rh-postgresql96/lib/pgsql/backups/
Templates/usr/share/pgsql//opt/rh/postgresql92/root/usr/share/pgsql//opt/rh/rh-postgresql95/root/usr/share/pgsql//opt/rh/rh-postgresql96/root/usr/share/pgsql/
Procedural Languages/usr/lib64/pgsql//opt/rh/postgresql92/root/usr/lib64/pgsql//opt/rh/rh-postgresql95/root/usr/lib64/pgsql//opt/rh/rh-postgresql96/root/usr/lib64/pgsql/
Development Headers/usr/include/pgsql//opt/rh/postgresql92/root/usr/include/pgsql//opt/rh/rh-postgresql95/root/usr/include/pgsql//opt/rh/rh-postgresql96/root/usr/include/pgsql/
Other shared data/usr/share/pgsql//opt/rh/postgresql92/root/usr/share/pgsql//opt/rh/rh-postgresql95/root/usr/share/pgsql//opt/rh/rh-postgresql96/root/usr/share/pgsql/
Regression tests/usr/lib64/pgsql/test/regress/ (in the -test package)/opt/rh/postgresql92/root/usr/lib64/pgsql/test/regress/ (in the -test package)/opt/rh/rh-postgresql95/root/usr/lib64/pgsql/test/regress/ (in the -test package)/opt/rh/rh-postgresql96/root/usr/lib64/pgsql/test/regress/ (in the -test package)
For changes between PostgreSQL 8.4 and PostgreSQL 9.2, refer to the Red Hat Software Collections 1.2 Release Notes. Notable changes between PostgreSQL 9.2 and PostgreSQL 9.4 are described in Red Hat Software Collections 2.0 Release Notes. For differences between PostgreSQL 9.4 and PostgreSQL 9.5, refer to Red Hat Software Collections 2.2 Release Notes.

5.6.2. Migrating from a Red Hat Enterprise Linux System Version of PostgreSQL to the PostgreSQL 9.6 Software Collection

Red Hat Enterprise Linux 6 includes PostgreSQL 8.4, Red Hat Enterprise Linux 7 is distributed with PostgreSQL 9.2. To migrate your data from a Red Hat Enterprise Linux system version of PostgreSQL to the rh-postgresql96 Software Collection, you can either perform a fast upgrade using the pg_upgrade tool (recommended), or dump the database data into a text file with SQL commands and import it in the new database. Note that the second method is usually significantly slower and may require manual fixes; see the PostgreSQL documentation for more information about this upgrade method. The following procedures are applicable for both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7 system versions of PostgreSQL.

Important

Before migrating your data from a Red Hat Enterprise Linux system version of PostgreSQL to PostgreSQL 9.6, make sure that you back up all your data, including the PostgreSQL database files, which are by default located in the /var/lib/pgsql/data/ directory.

Procedure 5.5. Fast Upgrade Using the pg_upgrade Tool

To perform a fast upgrade of your PostgreSQL server, complete the following steps:
  1. Stop the old PostgreSQL server to ensure that the data is not in an inconsistent state. To do so, type the following at a shell prompt as root:
    service postgresql stop
    To verify that the server is not running, type:
    service postgresql status
  2. Verify that the old directory /var/lib/pgsql/data/ exists:
    file /var/lib/pgsql/data/
    and back up your data.
  3. Verify that the new data directory /var/opt/rh/rh-postgresql96/lib/pgsql/data/ does not exist:
    file /var/opt/rh/rh-postgresql96/lib/pgsql/data/
    If you are running a fresh installation of PostgreSQL 9.6, this directory should not be present in your system. If it is, back it up by running the following command as root:
    mv /var/opt/rh/rh-postgresql96/lib/pgsql/data{,-scl-backup}
  4. Upgrade the database data for the new server by running the following command as root:
    scl enable rh-postgresql96 -- postgresql-setup --upgrade
    Alternatively, you can use the /opt/rh/rh-postgresql96/root/usr/bin/postgresql-setup --upgrade command.
    Note that you can use the --upgrade-from option for upgrade from different versions of PostgreSQL. The list of possible upgrade scenarios is available using the --upgrade-ids option.
    It is recommended that you read the resulting /var/lib/pgsql/upgrade_rh-postgresql96-postgresql.log log file to find out if any problems occurred during the upgrade.
  5. Start the new server as root:
    service rh-postgresql96-postgresql start
    It is also advised that you run the analyze_new_cluster.sh script as follows:
    su - postgres -c 'scl enable rh-postgresql96 ~/analyze_new_cluster.sh'
  6. Optionally, you can configure the PostgreSQL 9.6 server to start automatically at boot time. To disable the old system PostgreSQL server, type the following command as root:
    chkconfig postgresql off
    To enable the PostgreSQL 9.6 server, type as root:
    chkconfig rh-postgresql96-postgresql on
  7. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql96/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

Procedure 5.6. Performing a Dump and Restore Upgrade

To perform a dump and restore upgrade of your PostgreSQL server, complete the following steps:
  1. Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as root:
    service postgresql start
  2. Dump all data in the PostgreSQL database into a script file. As root, type:
    su - postgres -c 'pg_dumpall > ~/pgdump_file.sql'
  3. Stop the old server by running the following command as root:
    service postgresql stop
  4. Initialize the data directory for the new server as root:
    scl enable rh-postgresql96-postgresql -- postgresql-setup --initdb
  5. Start the new server as root:
    service rh-postgresql96-postgresql start
  6. Import data from the previously created SQL file:
    su - postgres -c 'scl enable rh-postgresql96 "psql -f ~/pgdump_file.sql postgres"'
  7. Optionally, you can configure the PostgreSQL 9.6 server to start automatically at boot time. To disable the old system PostgreSQL server, type the following command as root:
    chkconfig postgresql off
    To enable the PostgreSQL 9.6 server, type as root:
    chkconfig rh-postgresql96-postgresql on
  8. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql96/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

5.6.3. Migrating from the PostgreSQL 9.5 Software Collection to the PostgreSQL 9.6 Software Collection

To migrate your data from the rh-postgresql95 Software Collection to the rh-postgresql96 Collection, you can either perform a fast upgrade using the pg_upgrade tool (recommended), or dump the database data into a text file with SQL commands and import it in the new database. Note that the second method is usually significantly slower and may require manual fixes; see the PostgreSQL documentation for more information about this upgrade method.

Important

Before migrating your data from PostgreSQL 9.5 to PostgreSQL 9.6, make sure that you back up all your data, including the PostgreSQL database files, which are by default located in the /var/opt/rh/rh-postgresql95/lib/pgsql/data/ directory.

Procedure 5.7. Fast Upgrade Using the pg_upgrade Tool

To perform a fast upgrade of your PostgreSQL server, complete the following steps:
  1. Stop the old PostgreSQL server to ensure that the data is not in an inconsistent state. To do so, type the following at a shell prompt as root:
    service rh-postgresql95-postgresql stop
    To verify that the server is not running, type:
    service rh-postgresql95-postgresql status
  2. Verify that the old directory /var/opt/rh/rh-postgresql95/lib/pgsql/data/ exists:
    file /var/opt/rh/rh-postgresql95/lib/pgsql/data/
    and back up your data.
  3. Verify that the new data directory /var/opt/rh/rh-postgresql96/lib/pgsql/data/ does not exist:
    file /var/opt/rh/rh-postgresql96/lib/pgsql/data/
    If you are running a fresh installation of PostgreSQL 9.6, this directory should not be present in your system. If it is, back it up by running the following command as root:
    mv /var/opt/rh/rh-postgresql96/lib/pgsql/data{,-scl-backup}
  4. Upgrade the database data for the new server by running the following command as root:
    scl enable rh-postgresql96 -- postgresql-setup --upgrade --upgrade-from=rh-postgresql95-postgresql
    Alternatively, you can use the /opt/rh/rh-postgresql96/root/usr/bin/postgresql-setup --upgrade --upgrade-from=rh-postgresql95-postgresql command.
    Note that you can use the --upgrade-from option for upgrading from different versions of PostgreSQL. The list of possible upgrade scenarios is available using the --upgrade-ids option.
    It is recommended that you read the resulting /var/lib/pgsql/upgrade_rh-postgresql96-postgresql.log log file to find out if any problems occurred during the upgrade.
  5. Start the new server as root:
    service rh-postgresql96-postgresql start
    It is also advised that you run the analyze_new_cluster.sh script as follows:
    su - postgres -c 'scl enable rh-postgresql96 ~/analyze_new_cluster.sh'
  6. Optionally, you can configure the PostgreSQL 9.6 server to start automatically at boot time. To disable the old PostgreSQL 9.5 server, type the following command as root:
    chkconfig rh-postgresql95-postgreqsql off
    To enable the PostgreSQL 9.6 server, type as root:
    chkconfig rh-postgresql96-postgresql on
  7. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql96/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.

Procedure 5.8. Performing a Dump and Restore Upgrade

To perform a dump and restore upgrade of your PostgreSQL server, complete the following steps:
  1. Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as root:
    service rh-postgresql95-postgresql start
  2. Dump all data in the PostgreSQL database into a script file. As root, type:
    su - postgres -c 'scl enable rh-postgresql95 "pg_dumpall > ~/pgdump_file.sql"'
  3. Stop the old server by running the following command as root:
    service rh-postgresql95-postgresql stop
  4. Initialize the data directory for the new server as root:
    scl enable rh-postgresql96-postgresql -- postgresql-setup --initdb
  5. Start the new server as root:
    service rh-postgresql96-postgresql start
  6. Import data from the previously created SQL file:
    su - postgres -c 'scl enable rh-postgresql96 "psql -f ~/pgdump_file.sql postgres"'
  7. Optionally, you can configure the PostgreSQL 9.6 server to start automatically at boot time. To disable the old PostgreSQL 9.5 server, type the following command as root:
    chkconfig rh-postgresql95-postgresql off
    To enable the PostgreSQL 9.6 server, type as root:
    chkconfig rh-postgresql96-postgresql on
  8. If your configuration differs from the default one, make sure to update configuration files, especially the /var/opt/rh/rh-postgresql96/lib/pgsql/data/pg_hba.conf configuration file. Otherwise only the postgres user will be allowed to access the database.
If you need to migrate from the postgresql92 Software Collection, refer to Red Hat Software Collections 2.0 Release Notes; the procedure is the same, you just need to adjust the version of the new Collection. The same applies to migration from the rh-postgresql94 Software Collection, which is described in Red Hat Software Collections 2.2 Release Notes.

5.7. Migrating to nginx 1.12

The rh-nginx112 Software Collection is available only for Red Hat Enterprise Linux 7.4 and later versions.
The root directory for the rh-nginx112 Software Collection is located in /opt/rh/rh-nginx112/root/. The error log is stored in /var/opt/rh/rh-nginx112/log/nginx by default.
Configuration files are stored in the /etc/opt/rh/rh-nginx112/nginx/ directory. Configuration files in nginx 1.12 have the same syntax and largely the same format as previous nginx Software Collections.
Configuration files (with a .conf extension) in the /etc/opt/rh/rh-nginx112/nginx/default.d/ directory are included in the default server block configuration for port 80.

Important

Before upgrading from nginx 1.10 to nginx 1.12, back up all your data, including web pages located in the /opt/rh/nginx110/root/ tree and configuration files located in the /etc/opt/rh/nginx110/nginx/ tree.
If you have made any specific changes, such as changing configuration files or setting up web applications, in the /opt/rh/nginx110/root/ tree, replicate those changes in the new /opt/rh/rh-nginx112/root/ and /etc/opt/rh/rh-nginx112/nginx/ directories, too.
You can use this procedure to upgrade directly from nginx 1.4, nginx 1.6, nginx 1.8, or nginx 1.10 to nginx 1.12. Use the appropriate paths in this case.
For the official nginx documentation, refer to http://nginx.org/en/docs/.
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.