Updating to PostgreSQL 8.x

As of version 5.5, PureMessage includes an improved version of PostgreSQL. If you are upgrading to PureMessage 5.5 or later from a previous version of PureMessage, the new version of PostgreSQL will be added to your installation, but it will be disabled by default.

To begin using PureMessage with PostgreSQL 8.x, you must first transfer your data from the old version of PostgreSQL to the new version of PostgreSQL using pmx-pg-migrate.

Following the migration, you must run pmx-pg-switch (as the root user) to configure PureMessage to use the new version of PostgreSQL.

Before starting the migration, stop PureMessage, and ensure that your PureMessage database server has the minimum shared memory allocation (as described in the "Tuning PostgreSQL for PureMessage 5.x" article in Sophos's online Knowledgebase).

Ensure also that you have sufficient disk space to create a backup of your data before performing the migration. The data is stored in a temporary directory that is created during the migration (/opt/pmx/home/ by default). The time required for a migration will vary, according to the size of your database.

To upgrade from PostgreSQL 7.4 to 8.x:

  1. As the pmx user, run pmx stop.
  2. As the pmx user, run pmx-pg-migrate. If you have a large database, this command will take a considerable amount of time to run.
  3. Switch to the root user, and run pmx-pg-switch.
  4. Switch back to the pmx user, and run pmx-database restart.
  5. Once you are satisfied that all data has been successfully migrated and the new database is functioning as expected, you can safely remove the old data, which has been moved to /opt/pmx/postgres-7.x.
Note:

The pg_xlog for PostgreSQL 8 is not backwards compatible with the pg_xlog for PostgreSQL 7.4. If there is symlink to pg_xlog for PostgreSQL 8, and you opt to roll back to PostgreSQL 7.4, you must reset the pg_xlog.

To reset the transaction log when rolling back to PostgreSQL 7.4:

$ rm /disk2/pg_xlog/* #Removes the existing PostgreSQL 8 transaction log
$ /opt/pmx/postgres-7.4.8/bin/pg_resetxlog -f  #Makes pg_xlog compatible with PostgreSQL 7.4
Related information
pmx-pg-migrate
pmx-pg-switch
Tuning PostgreSQL for PureMessage 5.x