Table of Contents Previous Next


4 Moving the Postgres Enterprise Manager™Server

The backing database of the target server may be a different version or type than the backing database of the source. If the new PEM server does not reside on the same type of backing database as the original server, you must ensure that the same version of the sslutils extension is installed on the new server host. The version of sslutils that is distributed with the PEM installers is freely available for download from the EnterpriseDB website at:
For information about installing the PEM server or the sslutils extension, please refer to the PEM Installation Guide, available at:
The migration process re-creates the pem, pemdata, and pemhistory schemas from the source PEM server on the target PEM server. In preparation for the move, use the psql client to delete these schemas from the pem database on the target host. You can open the psql client at the command line, or by selecting SQL Shell (psql) from the Postgres Enterprise Manager menu.
When the psql client opens, connect to the pem backing database as the database superuser. After connecting to the pem database on the target host, use the following commands to drop the schemas:
When dropping the schemas, you must include the CASCADE keyword, instructing the server to delete all dependent objects. When executing the command, the psql client displays a list of the dependent objects; the client confirms each the schema is removed by displaying DROP SCHEMA (as shown in Figure 4.1).
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\14a9230a\movetwo.png
SELECT id FROM pem.agent WHERE active = true;

C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\5b56b8cd\msthree.png
Where x specifies an agent number (see Figure 4.3). Remember, agent1 is created on the target host by the PEM server installer.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\1622249f\movefour.png
Then, use the GRANT command to assign each agent that resides on the target PEM server pem_agent permissions:
Where x specifies an agent number (see Figure 4.4).
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\d8573dc4\movefive.png
You can use the pg_dump utility to generate a script that contains the commands required to recreate the pem database on the target host. By default, pg_dump is installed in the bin directory under your Postgres installation. To invoke pg_dump, open a command line, navigate to the bin directory, and enter:
pg_dump -U user_name db_name > file_name
user_name specifies the name of the database superuser for the PEM backing database.
file_name specifies the name of the script generated by pg_dump.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\da5d3bf2\mssix.png
The command shown in Figure 4.5 instructs pg_dump to generate a script that (when executed) will re-create the pem database. The script will be named backup.sql, and will be created in the tmp directory. pg_dump is connecting to the server using the credentials of the user, postgres.
Note that invoking the pg_dump utility will not interrupt current database users.
Move the script generated by the pg_dump utility to the target host of the PEM server.
Open a command line on the target host and navigate into the bin directory (under the Postgres backing database installation directory). Start psql, executing the script generated by the pg_dump utility:
psql -U user_name -d pem -f file_name
user_name specifies the name of the database superuser. The user specified must have connection privileges for the backing database.
file_name specifies the complete path to the backup script generated by pg_dump.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\d8d43c60\moveseven.png
The example shown in Figure 4.6 uses the psql client to invoke a script named backup.sql to recreate the pem database. The script is invoked using the privileges associated with the database superuser, postgres.
/etc/init.d/service_name stop
service_name specifies the name of the backing database server. For a PostgreSQL backing database, the service name is postgresql-9.x, and for an Advanced Server backing database, the service name is ppas-9.x, where x specifies the version number.
If you are using Windows, you can use the Services dialog to control the service. To open the Services dialog, navigate through the Control Panel to the System and Security menu. Select Administrative Tools, and then double-click the Services icon. When the Services dialog opens, highlight the service name in the list, and use the option provided on the dialog to Stop the service.
Copy the files to the data directory under the Postgres installation that provides the backing database for the target cluster. On Linux, by default, the files reside in:
On Linux, the certificate files must be owned by postgres. You can use the following command at the command line to modify the ownership of the files:
Where file_name specifies the name of the certificate file.
The server.crt file may only be modified by the owner of the file, but may be read by any user. You can use the following command to set the file permissions for the server.crt file:
chmod 600 file_name
Where file_name specifies the name of the file.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\8e39848c\server_key.png
Navigate to the Security tab (see Figure 4.7) and highlight a Group or user name to view the assigned permissions. Select Edit or Advanced to access dialogs that allow you to modify the permissions associated with the selected user.
Copy the agent1.key and agent1.crt files from the source host to the target host. By default, on Linux, the files are installed in /root/.pem; copy the files to the same directory on the target host.
If necessary, navigate to /root/.pem, and use the following commands to modify the permissions and ownership of the agent1.key file:
Copy the agent1.key and agent1.crt files from the source host to the target host. On Windows, the files are located in:
C:\Users\user_name\AppData\Roaming\pem
Where user_name is the name of the user that invoked the PEM installer.
The ownership and permissions associated with the certificate files on the target machine should match the ownership and permissions of the certificate files on the source machine. If you invoked the PEM server and Postgres installer using the Run as Administrator option (selected from the context menu of the installer), the owner of the agent certificate files will be Administrators.
To review and modify file permissions on Windows, right-click on the file name, and select Properties. Navigate to the Security tab and highlight a Group or user name to view the assigned permissions. Select Edit or Advanced to access dialogs that allow you to modify the permissions associated with the selected user.
Modify the pg_hba.conf file on the target host to allow connections from each PEM agent. By default, the pg_hba.conf file is located in the data directory under your Postgres installation.
After modifying the pg_hba.conf file, you must restart the server for the changes to take effect.
/etc/init.d/service_name start
Where service_name is the name of the backing database server.
If you are using Windows, you can use the Services dialog to control the service. To open the Services dialog, navigate through the Control Panel to the System and Security menu. Select Administrative Tools, and then double-click the Services icon. When the Services dialog opens, highlight the service name in the list, and use the option provided on the dialog to Start the service.
Use your choice of editor to modify the agent.cfg file (shown in Figure 4.8), specifying the new IP address and port number of the PEM server in the pem_host and pem_port parameters.
By default, the agent.cfg file is located in:
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\85928a04\agentcfg.png
After modifying the agent.cfg file, you must restart the PEM agent service; you can use the pemagent service script on the Linux command line to restart the service:
Before modifying the Windows registry on the monitored node, confirm that the firewall on the host of the PEM agent will allow connections to the PEM server. After confirming that the PEM agent host can connect to the PEM server host, you can use the Windows Registry Editor to review and edit the PEM_HOST and PEM_PORT entries to ensure that they correctly identify the host and port used by the PEM server. To open the Registry Editor, enter regedit in the Windows Run dialog or in the Windows start menu search box.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\5171f269\Screen Shot 2016-11-03 at 9.50.24 AM.png
The PEM_HOST and PEM_PORT entries must specify the address and port number of the new PEM server on the target host. To modify a registry entry, right click on the entry Name, and select Modify from the context menu to open the Edit String dialog.
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\cbd449a5\chregistry.png
Use the Edit String dialog to make any changes to the value of the entry (see Figure 4.10). When you're finished, click OK to save your changes, or Cancel to exit without saving.
After modifying the registry, you must restart the PEM agent's service; you can use the Services dialog (accessed through the Windows Control Panel) to restart the Postgres Enterprise Manager - pemAgent service (see Figure 4.11).
C:\Users\susan\AppData\Local\Temp\vmware-susan\VMwareDnD\cbd54186\services.png

4 Moving the Postgres Enterprise Manager™Server

Table of Contents Previous Next