Overview

This article contains instructions on how to move OA system PostgreSQL database from the Management Node to a separate server. Please note that during the operation, the provisioning engine and control panel will not be available. The new database server should have at least as much memory as the Management Node has.

The migration process consists of two parts: migration of the system database itself (which can be performed in different ways, two of them are described in this article), and configuring Operations Automation (OA) to use the new database server.

Database migration (physical copy)

This method of migration is simpler than the second method described, and it is usually faster. However, you need to use a new database server with the same architecture/OS.

  1. Shut down Operations Automation on the Management Node:

    • before OA 6.0: # /etc/init.d/pem stop

    • OA 6.0: # service pau stop # service pem stop
  2. Shut down PostgreSQL on the Management Node (depending on the OA version):

    • before OA 5.5: # /etc/init.d/postgresql-9.0 stop
    • OA 5.5: # /etc/init.d/postgresql-9.1 stop
  3. Install the PostgreSQL server on the new database server. You need to install the following RPMs from the OA distribution with dependencies(depending on the OA version):

    • before OA 5.5:

      • postgresql90-9.0.4-2.parallels
      • postgresql90-libs-9.0.4-2.parallels
      • postgresql90-server-9.0.4-2.parallels
      • postgresql90-odbc-09.00.0300-1.parallels
      • pgtune-0.9.3-2.parallels.
    • OA 5.5:

      • postgresql90-libs-9.0.10-1PGDG
      • postgresql90-odbc-09.00.0310-3.parallels
      • postgresql91-9.1.6-1PGDG
      • postgresql91-server-9.1.6-1PGDG
      • postgresql91-libs-9.1.6-1PGDG
      • postgresql-libs-8.1.23-1.el5_7.3
      • pgtune-0.9.3-3 (for CentOS6/RHEL6)
      • pgtune-0.9.3-4 (for CentOS5/RHEL5)

      Note: Starting from OA 7.2, a custom odin-pg-tune utility is used for tuning the database. For more details, refer to https://kb.cloudblue.com/en/130616.

    Install all listed RPMs if the database server is x86_64, and install only the i386 RPMs if it is not. Do NOT start the PostgreSQL server yet.

  4. Configure the kernel parameters kernel.shmall and kernel.shmmax on the new database server in the same way they are configured on the OA Management Node:

    1. Copy the lines kernel.shmmax = ... and kernel.shmall = ... from the /etc/sysctl.conf on the Management Node, paste them to the /etc/sysctl.conf on the new database server
    2. Execute the command sysctl -p on the new database server.
  5. Copy the content of the database folder from the OA Management Node to the new database server:

    • before OA 5.5: var/lib/pgsql/9.0/data/
    • OA 5.5: var/lib/pgsql/9.1/data/

    Remember to preserve ownership and permissions of the files. For example, you may do it in the following way:

    • Create archive on the OA Management Node:

      • before OA 5.5: # tar cvf db.tar -C /var/lib/pgsql/9.0/data
      • OA 5.5: # tar cvf db.tar -C /var/lib/pgsql/9.1/data
    • Copy archive to the new database server:

      # scp db.tar $db_server_name:
      
    • Unpack the archive on the database server:

      • before OA 5.5: tar xvf db.tar -C /var/lib/pgsql/9.0
      • OA 5.5: tar xvf db.tar -C /var/lib/pgsql/9.1
  6. Add to chkconfig and start PostreSQL server on the new database server:

    • before OA 5.5: # chkconfig postgresql-9.0 on # /sbin/service postgresql-9.0 start

    • OA 5.5: # chkconfig postgresql-9.1 on # /sbin/service postgresql-9.1 start

If you experience problems with the database start, look at the file /var/lib/pgsql/9.0/pgstartup.log (/var/lib/pgsql/9.1/pgstartup.log for OA 5.5) to identify the reason.

DB migration (export/import)

This way of migration is more complicated than the previous one, but it allows you to migrate the database to a different platform, for example. Also, after this kind of migration, data is organized on the disk in a more optimal way.

  1. Shut down PostgreSQL on the OA Management Node:

    • before OA 5.5: # /etc/init.d/postgresql-9.0 stop
    • OA 5.5: # /etc/init.d/postgresql-9.1 stop
  2. Install the PostgreSQL server on the new database server. You need to install the following RPMs from the OA distribution with dependencies(depending on the OA version):

    • before OA 5.5:

      • postgresql90-9.0.4-2.parallels
      • postgresql90-libs-9.0.4-2.parallels
      • postgresql90-server-9.0.4-2.parallels
      • postgresql90-odbc-09.00.0300-1.parallels
      • pgtune-0.9.3-2.parallels.
    • OA 5.5:

      • postgresql90-libs-9.0.10-1PGDG
      • postgresql90-odbc-09.00.0310-3.parallels
      • postgresql91-9.1.6-1PGDG
      • postgresql91-server-9.1.6-1PGDG
      • postgresql91-libs-9.1.6-1PGDG
      • postgresql-libs-8.1.23-1.el5_7.3
      • pgtune-0.9.3-3 (for CentOS6/RHEL6)
      • pgtune-0.9.3-4 (for CentOS5/RHEL5)

    Install all listed RPMs if the database server is x86_64, and install only the i386 RPMs if it is not. Do NOT start the PostgreSQL server yet.

  3. Configure the kernel parameters kernel.shmall and kernel.shmmax on the new database server in the same way they are configured on the OA Management Node:

    1. Copy the lines kernel.shmmax = ... and kernel.shmall = ... from the /etc/sysctl.conf on the Management Node, paste them to the /etc/sysctl.conf on the new database server
    2. Execute the command sysctl -p on the new database server.
  4. Init the new PostgreSQL database on the new database server:

    • before OA 5.5: /etc/init.d/postgresql-9.0 initdb
    • OA 5.5: /etc/init.d/postgresql-9.1 initdb
  5. Add to chkconfig and start the PostgreSQL server on the new database server:

    • before OA 5.5: # chkconfig postgresql-9.0 on # /etc/init.d/postgresql-9.0 start

    • OA 5.5: # chkconfig postgresql-9.1 on # /etc/init.d/postgresql-9.1 start
  6. Copy the files /var/lib/pgsql/9.0/data/postgresql.conf and /var/lib/pgsql/9.0/data/pg_hba.conf from the OA Management Node to the new database server.

  7. Restart PostgreSQL on the new database server:

    • before OA 5.5: /etc/init.d/postgresql-9.0 restart
    • OA 5.5: /etc/init.d/postgresql-9.1 restart
  8. Shut down Operations Automation services on the Management Node:

    # service pem stop
    
  9. Create dump of the system database on the OA Management Node:

    # pg_dump -Upostgres -h `hostname` -C plesk > plesk.dump
    
  10. Create new database user on the new database server. Execute the command below on the OA Management Node:

    # createuser -Upostgres -h $new_db_server_hostname -SDR plesk
    
  11. Restore the database dump you just created on the new database server. Execute the command below on the OA Management Node:

    # psql -Upostgres -h $new_db_server_hostname -f plesk.dump
    
  12. Stop the PostgreSQL server on the OA Management Node; it is no longer needed there.

Configuring Operations Automation

  • Before OA 6.0

Edit the file /usr/local/pem/etc/odbc.ini on the OA Management Node - change the value of the "Servername" property to the name of the new database server.

Start OA services:

    # service pem start
  • After OA 6.0

    1. Edit the file /usr/local/pem/etc/odbc.ini on the OA Management Node - change the value of the "Servername" property to the name of the new database server.

    2. Edit the file /usr/local/pem/jboss-eap-6.2/standalone/configuration/standalone-full.xml - on the OA Management Node - change the value of the "jdbc:postgresql" property to the name of the new database server.

    3. Start OA services:

.

# service pau start
# service pem start

Internal content

Link on internal Article