Este conteúdo não está disponível no idioma selecionado.
Chapter 5. Migration
5.1. Migrating to MariaDB 10.2
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
scl register
command.
5.1.1. Notable Differences Between the rh-mariadb101 and rh-mariadb102 Software Collections
SQL_MODE
variable has been changed; see the upstream documentation for details.
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
- Stop the rh-mariadb101 database server if it is still running.Before stopping the server, set the
innodb_fast_shutdown
option to0
, so thatInnoDB
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
- 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. - 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. - 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 themysql
user and SELinux context is correct. - Start the rh-mariadb102 database server.
service rh-mariadb102-mariadb start
- Perform the data migration.
scl enable rh-mariadb102 mysql_upgrade
If theroot
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
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
- On Non-Uniform Access Memory (NUMA) hardware, it is possible to configure
systemd
services to be launched using thenumactl
command; see the upstream recommendation. To use MongoDB with thenumactl
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 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 forsystemd
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
Backwards Incompatible Features
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
5.2.2. Upgrading from the rh-mongodb34 to the rh-mongodb36 Software Collection
Important
/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 be able to upgrade, the rh-mongodb34 instance must have
featureCompatibilityVersion
set to3.4
. CheckfeatureCompatibilityVersion
:~]$
scl enable rh-mongodb34 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})'
If themongod
server is configured with enabled access control, add the--username
and--password
options to themongo
command. - Install the MongoDB servers and shells from the rh-mongodb36 Software Collections:
~]#
yum install rh-mongodb36
- Stop the MongoDB 3.4 server:
~]#
systemctl stop rh-mongodb34-mongod.service
- Copy your data to the new location:
~]#
cp -a /var/opt/rh/rh-mongodb34/lib/mongodb/* /var/opt/rh/rh-mongodb36/lib/mongodb/
- Configure the
rh-mongodb36-mongod
daemon in the/etc/opt/rh/rh-mongodb36/mongod.conf
file. - Start the MongoDB 3.6 server:
~]#
systemctl start rh-mongodb36-mongod.service
- Enable backwards incompatible features:
~]$
scl enable rh-mongodb36 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )'
If themongod
server is configured with enabled access control, add the--username
and--password
options to themongo
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.
5.3. Migrating to MongoDB 3.4
5.3.1. Notable Differences Between MongoDB 3.2 and MongoDB 3.4
General Changes
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
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 newdecimal
data type
5.3.2. Upgrading from the rh-mongodb32 to the rh-mongodb34 Software Collection
Important
/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.
- Install the MongoDB servers and shells from the rh-mongodb34 Software Collections:
~]#
yum install rh-mongodb34
- Stop the MongoDB 3.2 server:
~]#
systemctl stop rh-mongodb32-mongod.service
Use theservice rh-mongodb32-mongodb stop
command on a Red Hat Enterprise Linux 6 system. - Copy your data to the new location:
~]#
cp -a /var/opt/rh/rh-mongodb32/lib/mongodb/* /var/opt/rh/rh-mongodb34/lib/mongodb/
- Configure the
rh-mongodb34-mongod
daemon in the/etc/opt/rh/rh-mongodb34/mongod.conf
file. - Start the MongoDB 3.4 server:
~]#
systemctl start rh-mongodb34-mongod.service
On Red Hat Enterprise Linux 6, use theservice rh-mongodb34-mongodb start
command instead. - Enable backwards-incompatible features:
~]$
scl enable rh-mongodb34 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )'
If themongod
server is configured with enabled access control, add the--username
and--password
options tomongo
command.Note that it is recommended to run the deployment after the upgrade without enabling these features first.
5.4. Migrating to MySQL 5.7
my.cnf
files need to be changed to prevent these specific resources from conflicting.
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 theCREATE USER
statement because theGRANT
statement no longer creates a user by default. See the upstream documentation for details.
5.4.2. Upgrading to the rh-mysql57 Software Collection
Important
- Install the rh-mysql57 Software Collection.
yum install rh-mysql57-mysql-server
- 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. - Stop the rh-mysql56 database server, if it is still running.
service rh-mysql56-mysqld stop
- 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. - Start the rh-mysql57 database server.
service rh-mysql57-mysqld start
- Perform the data migration.
scl enable rh-mysql57 mysql_upgrade
If theroot
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
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
Content | postgresql | rh-postgresql96 | rh-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/ |
Source | not installed | not installed | not 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
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
/var/lib/pgsql/data/
directory.
Procedure 5.1. Fast Upgrade Using the pg_upgrade
Tool
- 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
- Verify that the old directory
/var/lib/pgsql/data/
exists:file /var/lib/pgsql/data/
and back up your data. - 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 asroot
:mv /var/opt/rh/rh-postgresql10/lib/pgsql/data{,-scl-backup}
- 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. - Start the new server as
root
:systemctl start rh-postgresql10-postgresql.service
It is also advised that you run theanalyze_new_cluster.sh
script as follows:su - postgres -c 'scl enable rh-postgresql10 ~/analyze_new_cluster.sh'
- 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 asroot
:chkconfig rh-postgresql10-postgresql on
- 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 thepostgres
user will be allowed to access the database.
Procedure 5.2. Performing a Dump and Restore Upgrade
- Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as
root
:systemctl start postgresql.service
- Dump all data in the PostgreSQL database into a script file. As
root
, type:su - postgres -c 'pg_dumpall > ~/pgdump_file.sql'
- Stop the old server by running the following command as
root
:systemctl stop postgresql.service
- Initialize the data directory for the new server as
root
:scl enable rh-postgresql10-postgresql -- postgresql-setup --initdb
- Start the new server as
root
:systemctl start rh-postgresql10-postgresql.service
- Import data from the previously created SQL file:
su - postgres -c 'scl enable rh-postgresql10 "psql -f ~/pgdump_file.sql postgres"'
- 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 asroot
:chkconfig rh-postgresql10-postgresql on
- 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 thepostgres
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
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
/var/opt/rh/rh-postgresql96/lib/pgsql/data/
directory.
Procedure 5.3. Fast Upgrade Using the pg_upgrade
Tool
- 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
- 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. - 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 asroot
:mv /var/opt/rh/rh-postgresql10/lib/pgsql/data{,-scl-backup}
- 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. - Start the new server as
root
:systemctl start rh-postgresql10-postgresql.service
It is also advised that you run theanalyze_new_cluster.sh
script as follows:su - postgres -c 'scl enable rh-postgresql10 ~/analyze_new_cluster.sh'
- 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 asroot
:chkconfig rh-postgresql10-postgresql on
- 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 thepostgres
user will be allowed to access the database.
Procedure 5.4. Performing a Dump and Restore Upgrade
- Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as
root
:systemctl start rh-postgresql96-postgresql.service
- 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"'
- Stop the old server by running the following command as
root
:systemctl stop rh-postgresql96-postgresql.service
- Initialize the data directory for the new server as
root
:scl enable rh-postgresql10-postgresql -- postgresql-setup --initdb
- Start the new server as
root
:systemctl start rh-postgresql10-postgresql.service
- Import data from the previously created SQL file:
su - postgres -c 'scl enable rh-postgresql10 "psql -f ~/pgdump_file.sql postgres"'
- 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 asroot
:chkconfig rh-postgresql10-postgresql on
- 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 thepostgres
user will be allowed to access the database.
5.6. Migrating to PostgreSQL 9.6
5.6.1. Notable Differences Between PostgreSQL 9.5 and PostgreSQL 9.6
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.
Content | postgresql | postgresql92 | rh-postgresql95 | rh-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/ |
Source | not installed | not installed | not installed | not 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) |
5.6.2. Migrating from a Red Hat Enterprise Linux System Version of PostgreSQL to the PostgreSQL 9.6 Software Collection
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
/var/lib/pgsql/data/
directory.
Procedure 5.5. Fast Upgrade Using the pg_upgrade
Tool
- 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
- Verify that the old directory
/var/lib/pgsql/data/
exists:file /var/lib/pgsql/data/
and back up your data. - 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 asroot
:mv /var/opt/rh/rh-postgresql96/lib/pgsql/data{,-scl-backup}
- 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. - Start the new server as
root
:service rh-postgresql96-postgresql start
It is also advised that you run theanalyze_new_cluster.sh
script as follows:su - postgres -c 'scl enable rh-postgresql96 ~/analyze_new_cluster.sh'
- 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 asroot
:chkconfig rh-postgresql96-postgresql on
- 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 thepostgres
user will be allowed to access the database.
Procedure 5.6. Performing a Dump and Restore Upgrade
- Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as
root
:service postgresql start
- Dump all data in the PostgreSQL database into a script file. As
root
, type:su - postgres -c 'pg_dumpall > ~/pgdump_file.sql'
- Stop the old server by running the following command as
root
:service postgresql stop
- Initialize the data directory for the new server as
root
:scl enable rh-postgresql96-postgresql -- postgresql-setup --initdb
- Start the new server as
root
:service rh-postgresql96-postgresql start
- Import data from the previously created SQL file:
su - postgres -c 'scl enable rh-postgresql96 "psql -f ~/pgdump_file.sql postgres"'
- 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 asroot
:chkconfig rh-postgresql96-postgresql on
- 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 thepostgres
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
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
/var/opt/rh/rh-postgresql95/lib/pgsql/data/
directory.
Procedure 5.7. Fast Upgrade Using the pg_upgrade
Tool
- 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
- 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. - 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 asroot
:mv /var/opt/rh/rh-postgresql96/lib/pgsql/data{,-scl-backup}
- 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. - Start the new server as
root
:service rh-postgresql96-postgresql start
It is also advised that you run theanalyze_new_cluster.sh
script as follows:su - postgres -c 'scl enable rh-postgresql96 ~/analyze_new_cluster.sh'
- 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 asroot
:chkconfig rh-postgresql96-postgresql on
- 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 thepostgres
user will be allowed to access the database.
Procedure 5.8. Performing a Dump and Restore Upgrade
- Ensure that the old PostgreSQL server is running by typing the following at a shell prompt as
root
:service rh-postgresql95-postgresql start
- 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"'
- Stop the old server by running the following command as
root
:service rh-postgresql95-postgresql stop
- Initialize the data directory for the new server as
root
:scl enable rh-postgresql96-postgresql -- postgresql-setup --initdb
- Start the new server as
root
:service rh-postgresql96-postgresql start
- Import data from the previously created SQL file:
su - postgres -c 'scl enable rh-postgresql96 "psql -f ~/pgdump_file.sql postgres"'
- 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 asroot
:chkconfig rh-postgresql96-postgresql on
- 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 thepostgres
user will be allowed to access the database.
5.7. Migrating to nginx 1.12
/opt/rh/rh-nginx112/root/
. The error log is stored in /var/opt/rh/rh-nginx112/log/nginx
by default.
/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.
.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
/opt/rh/nginx110/root/
tree and configuration files located in the /etc/opt/rh/nginx110/nginx/
tree.
/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.