• Upgrading a PEM Installation - Section 2 provides information about upgrading your PEM server from one major version to another (i.e. from 6.0 to 7.5).
• Upgrading the Backing Database - Section 3 provides detailed information about upgrading the backing database, while maintaining the same version of the PEM Server.
• Moving a PEM Server –Section 4 provides detailed information about moving the PEM server from one host to another host.Please note that in future PEM releases, a graphical installer will not be available for the PEM agent or server on a Linux host; you will be required to use an RPM package to install or update a PEM installation. For detailed information about using an RPM package to update the Linux host of a PEM server or agent that was installed with the graphical installer, please see Section 5.This document uses the term Postgres to mean either the PostgreSQL or the Advanced Server database.
In the following descriptions a term refers to any word or group of words that are language keywords, user-supplied values, literals, etc. A term’s exact meaning depends upon the context in which it is used.
• Italic font introduces a new term, typically, in the sentence that defines it for the first time.
• Fixed-width (mono-spaced) font is used for terms that must be given literally such as SQL commands, specific table and column names used in the examples, programming language keywords, etc. For example, SELECT * FROM emp;
• Italic fixed-width font is used for terms for which the user must substitute values in actual usage. For example, DELETE FROM table_name;
• Square brackets [ ] denote that one or none of the enclosed term(s) may be substituted. For example, [ a | b ], means choose one of “a” or “b” or neither of the two.
• Braces {} denote that exactly one of the enclosed alternatives must be specified. For example, { a | b }, means exactly one of “a” or “b” must be specified.
• Ellipses ... denote that the proceeding term may be repeated. For example, [ a | b ] ... means that you may have the sequence, “b a a b a”.
1. Invoke the PEM agent installer on each monitored node except the PEM server node. Please note that your upgraded PEM 7.5 agents will work with the PEM 6 server while the upgrade is being performed.
2. Invoke the PEM server installer; this installer will upgrade both the PEM server and the PEM agent that resides on the PEM server node.
Where x.x.x specifies the version information for the installer.If you are a Windows user, you can invoke the installer by right-clicking on the downloaded installer's icon, and selecting Run as Administrator.The setup wizard will automatically detect an existing agent, and upgrade the installed version (see Figure 2.3). Click Next to continue.
To proceed with the installation, you may be required to provide a service account password. If prompted, provide the password and click Next to continue.When the Ready to Install dialog (shown in Figure 2.4) informs you that the installation is about to begin, click Next to continue.The PEM Agent Setup Wizard will inform you when the installation completes (see Figure 2.6). Click Finish to exit the wizard and close the window.
2. If upgrading from PEM 6.x, copy the configuration file to the location of the PEM 7.x configuration file (/usr/pem/agent/etc/agent.cfg). For example:For detailed information about using an RPM package to install the PEM agent, please see the PEM Installation Guide or the Advanced Server Installation Guide, available at:
Where x.x.x specifies the version information for the installer.If you are a Windows user, you can invoke the installer by right-clicking on the downloaded installer's icon, and selecting Run as Administrator.The PEM Server Setup Wizard welcomes you, as shown in Figure 2.7. Click Next to continue to the License Agreement.The PEM server setup wizard will prompt you to accept the License Agreement (shown in Figure 2.8). After reviewing the license agreement, check the radio button next to I accept the agreement, and click Next to continue to the Existing installation dialog.The wizard then opens the Database Server Installation Details dialog, prompting you for connection credentials for database superuser of the PEM backing database (see Figure 2.11). Provide:
• The name of the database superuser in the User field.
• The password associated with the database superuser in the Password field.Click Next to continue.The Ready to Install dialog will inform you that the setup wizard is ready to perform the installation. Click Next to start the installation (see Figure 2.12).Click OK to close the Info popup. The PEM server setup wizard informs you that the installation is complete (see Figure 2.15).
CIDR formatted network address range that agents will connect to the server from, to be added to the server's pg_hba.conf file. For example, 192.168.1.0/24. The default is 0.0.0.0/0. The directory for the database server installation. For example, /usr/edb/as10 for Advanced Server or /usr/pgsql-10 for PostgreSQL. The unit file name of the PEM database server. For Advanced Server, the default file name is edb-as-10; for PostgreSQL, it is postgresql-10. The installation type: Specify 1 if the configuration is for web services and backing database, 2 if you are configuring web services, or 3 if you are configuring the backing database. If you specify 3, please note that the database must reside on the local host.If you do not provide configuration properties on the command line, you will be prompted for values by the script. To view script-related help, use the command:After executing the PEM server configuration file, use your version-specific service control command to restart the httpd service.For detailed information about using an RPM package to install or configure the PEM server, please see the PEM Installation Guide or the Advanced Server Installation Guide, available at:
1. Delete the existing SQL Profiler query set on each node by invoking the uninstall-sql-profiler.sql script.By default, if you are using Advanced Server on a Linux host that was installed with a graphical installer, the script resides in the share/contrib directory under the Advanced Server installation.If you are using a PostgreSQL installation on a Linux host, the script resides in the share/postgresql/contrib directory under the PostgreSQL installation.On 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.
1. Delete the existing SQL Profiler query set on each node by invoking the uninstall-sql-profiler.sql script.By default, the script resides in the share\contrib directory under your Advanced Server or PostgreSQL installation.
If you are updating both PEM components and the PEM backing database, you should perform PEM component updates (the server, agents and client) before updating the backing database. For more information about updating PEM component software, see section 2.pg_upgrade supports a transfer of data between servers of the same type. For example, you can use pg_upgrade to move data from a PostgreSQL 9.6 backing database to a PostgreSQL 10 backing database, but not to an Advanced Server 10 backing database. If you wish to migrate to a different type of backing database (i.e from a PostgreSQL server to Advanced Server), please see Section 4 for details.You can optionally use a custom-built PostgreSQL server as a host of the PEM backing database. Note that if you are upgrading from a PostgreSQL backing database listening on port 5432, the new server must be configured to listen on a different port.The new backing database must be running the same version of sslutils that the current backing database is running; you can download the SSL Utils package that is used in EnterpriseDB installers at:You are not required to manually add the sslutils extension when using the Advanced Server as the new backing database. The process of configuring sslutils is platform-specific.When the download completes, extract the sslutils folder, and move it into the Postgres installation directory for the Postgres version to which you are upgrading.Open a command line, assume superuser privileges, and set the value of the PATH environment variable to allow make to locate the pg_config program:Postgres specifies either:
• PostgreSQL if you are upgrading to a PostgreSQL server.
• PostgresPlus if you are upgrading to an Advanced Server server.x.x specifies the version of Postgres to which you are migrating.sslutils must be compiled on the new backing database with the same compiler that was used to compile sslutils on the original backing database. If you are moving to a Postgres database that was installed using a PostgreSQL one-click installer (from EnterpriseDB) or an Advanced Server installer, use Visual Studio to build sslutils. If you are upgrading to:Copy the unpacked sslutils utilities folder to the Postgres installation directory (i.e. C:\Program Files\PostgreSQL\9.x).Open the Visual Studio command line, and navigate into the sslutils directory. Use the following commands to build sslutils:SET USE_PGXS=1
SET GETTEXTPATH=path_to_gettext
SET OPENSSLPATH=path_to_openssl
SET PGPATH=path_to_pg_installation_dir
SET ARCH=x86
msbuild sslutils.proj /p:Configuration=Releasepath_to_gettext specifies the location of the GETTEXT library and header files.path_to_openssl specifies the location of the openssl library and header files.path_to_pg_installation_dir specifies the location of the Postgres installation.SET USE_PGXS=1
SET OPENSSLPATH=C:\OpenSSL-Win32
SET GETTEXTPATH="C:\Program Files\PostgreSQL\10"
SET PGPATH="C:\Program Files\PostgreSQL\10"
SET ARCH=x86
msbuild sslutils.proj /p:Configuration=ReleaseCopy the compiled sslutils files to the appropriate directory for your installation; for example:Where service_name specifies the name of the Postgres service.On 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.You can use the pg_upgrade utility to perform an in-place transfer of existing data between the old backing database and the new backing database. If your server is configured to enforce md5 authentication, you may need to add an entry to the .pgpass file that specifies the connection properties (and password) for the database superuser, or modify the pg_hba.conf file to allow trust connections before invoking pg_upgrade. For more information about creating an entry in the .pgpass file, please see the PostgreSQL core documentation, available at:During the upgrade process, pg_upgrade will write a series of log files. The cluster owner must invoke pg_upgrade from a directory in which they have write privileges. If the upgrade completes successfully, pg_upgrade will remove the log files when the upgrade completes. To instruct pg_upgrade to not delete the upgrade log files, include the --retain keyword when invoking pg_upgrade.path_to_pg_upgrade/pg_upgrade
-d old_data_dir_path
-D new_data_dir_path
-b old_bin_dir_path -B new_bin_dir_path
-p old_port -P new_port
-u user_namepath_to_pg_upgrade specifies the location of the pg_upgrade utility. By default, pg_upgrade is installed in the bin directory under your Postgres directory.old_data_dir_path specifies the complete path to the data directory of the old backing database.new_data_dir_path specifies the complete path to the data directory of the new backing database.old_bin_dir_path specifies the complete path to the bin directory of the old backing database.new_bin_dir_path specifies the complete path to the bin directory of the old backing database.old_port specifies the port on which the old server is listening.user_name specifies the name of the cluster owner.Copy the following certificate files from the data directory of the old backing database to the data directory of the new backing database:
•
•
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_nameWhere file_name specifies the name of the file.On Windows, the certificate files moved from the source host must be owned by the service account that performed the PEM server and backing database installation on the target host. 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 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 (see Figure 3.3) 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.The postgresql.conf file contains parameter settings that specify server behavior. You will need to modify the postgresql.conf file on the new server to match the configuration specified in the postgresql.conf file of the old server.On Linux, in /opt/PostgreSQL/10.x/dataOn Windows, in C:\Program Files\PostgreSQL\10.x\dataUse your choice of editor to update the postgresql.conf file of the new server. Modify the following parameters:The port parameter to listen on the port monitored by your original backing database (typically, 5432).You must also ensure that the following parameters are enabled. If the parameters are commented out, remove the pound sign from in front of each postgresql.conf file entry:Your installation may have other parameter settings that require modification to ensure that the new backing database behaves in a manner comparable to the old backing database. Review the postgresql.conf files carefully to ensure that the configuration of the new server matches the configuration of the old server.The pg_hba.conf file contains parameter settings that specify how the server will enforce host-based authentication. When you install the PEM server, the installer modifies the pg_hba.conf file, adding entries to the top of the file:On Linux, in /opt/PostgreSQL/10.x/dataOn Windows, in C:\Program Files\PostgreSQL\10.x\dataUsing your editor of choice, copy the entries from the pg_hba.conf file of the old server to the pg_hba.conf file for the new server.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.
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).Before moving the PEM server, you must identify the number of agents that are monitored by the source PEM server, and create identities for that number of agents (less one) on the target server. To discover the total number of PEM agents monitored by the PEM server, connect to the pem database on the source host with the psql client, and query the pem.agent table (as shown in Figure 4.2).SELECT id FROM pem.agent WHERE active = true;You must manually create the number of agents that reside on the original PEM server, less one; the PEM server installer has already created one agent on the target host. For example, if the source server contains three agents, you must manually create two additional agents. Open a psql session with the pem database on the target server, and create the required agents. Use the command:Where x specifies an agent number (see Figure 4.3). Remember, agent1 is created on the target host by the PEM server installer.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).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: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.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:user_name specifies the name of the database superuser. The user specified must have connection privileges for the backing database.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.service_name specifies the name of the backing database server. For a PostgreSQL backing database, the service name is postgresql-x.x, and for an Advanced Server backing database, the service name is ppas-x.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_nameWhere file_name specifies the name of the file.On Windows, the certificate files moved from the source host must be owned by the service account that performed the PEM server and backing database installation on the target host. 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 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 (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: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.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: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.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.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).
The default installation location for the PEM server when installed by the graphical installer is /opt/edb/pem. In the example that follows, substitute your server installation location for PEM_installation_path.
3. Set SELinux to permissive mode and install the epel packages:
5. When the repository configuration file installation completes, use your choice of editor to modify the dependencies and tools repository definitions, ensuring that the repository definitions are enabled and providing the correct repository credentials. For example, to use vi, enter:
6. The yum makecache command downloads the metadata for the currently enabled repositories; when the command completes, check the available packages to confirm that the list includes the latest PEM server:
7. Install the PEM server RPM; when the installation completes, use the yum info command to confirm the installation details:
8. After installation, copy the agent.cfg file from the current location (the location required by the graphical installer) to the location required by the RPM package:Then, set the value of the ca_file parameter:
10. Copy the pem.db file (and other required files) to the RPM installation location and change the file ownership:
11. Change the home directory in the passwd file from the location identified by the graphical installer to the RPM location as follows:
16.
The default installation location for the PEM server when installed by the graphical installer is /opt/edb/pem. In the example that follows, substitute your server installation location for PEM_installation_path.
1. Use the version specific command to stop the pemagent service.
2. Set SELinux to permissive mode and install the supporting epel packages :
3. Set SELinux to permissive mode and install the epel packages:
5. When the repository configuration file installation completes, use your choice of editor to modify the dependencies and tools repository definitions, ensuring that the repository definitions are enabled and providing the correct repository credentials:
6. The yum makecache command downloads the metadata for the currently enabled repositories; when the command completes, check the available packages to confirm that the list includes the latest PEM agent:Then, set the value of the ca_file parameter:Then, copy the agent certificates; in the following commands, agent_id should specify the agent identifier (for example, agent2 or agent3):
13. Enable the pemagent service, and start pemagent and httpd. On a RHEL or CentOS 7.x host, use the commands:
When restoring the pem backing database from backup, you may encounter an error during the restoration of the pem.alert table. This is caused by a missing table pre-requisite for the table - the pg_restore utility may restore the pem.alert pre-requisites after it attempts to restore pem.alert.If this happens, the output from pg_restore will include error messages that refer to the alert table:If you encounter this problem, restore the pem database before restoring the pem.alert table. Restoring the pem database will install the pre-requisites for pem.alert, and the restoration of the table should complete as expected.
Where component_name is the name of the component that you wish to remove.If the PEM installation resides on a Windows host, you can use the Windows Add/Remove Programs application to remove PEM components. Select the Add/Remove Programs option from the Windows Control Panel; when the control panel opens, locate the name of the PEM component in the program list. Click the Remove button to remove the component.