Go to main content

Oracle® Solaris Cluster Data Service for PostgreSQL Guide

Exit Print View

Updated: June 2017
 
 

Preparing Your PostgreSQL Installation for Cluster Control

To prepare your PostgreSQL installation for cluster control, you create a database, a user, and a table to be monitored by the PostgreSQL resource. Because you need to differentiate between a global zone configuration and an HA for Solaris Zones configuration, two procedures are provided.

How to Prepare Your PostgreSQL for Oracle Solaris Cluster Registration in the Global Zone

Before You Begin

Ensure that you have edited the pgs_config file to specify configuration parameters for the HA for PostgreSQL data service. For more information, see Specifying Configuration Parameters for the PostgreSQL Resource.

  1. As the root role, change the rights of the configuration file to be accessible for your PostgreSQL user.
    # chmod 755 /myplace/pgs_config
  2. Switch to your PostgreSQL user.
    # su - postgres
  3. If the login shell is not the Korn shell, switch to ksh.
    % ksh
  4. Set the necessary variables.
    $ . /myplace/pgs_config
    $ export PGDATA PGPORT LD_LIBRARY_PATH
  5. If your PostgreSQL is not already running, start the PostgreSQL server.
    $ $PGROOT/bin/pg_ctl -l $PGLOGFILE start
  6. Prepare the database.
    • If you specified the password for the monitoring user in the configuration file or if you do not have a password, do the following:
      $ /opt/SUNWscPostgreSQL/util/pgs_db_prep -f /myplace/pgs_config
    • If you have a password and do not want to specify it in clear text, do the following:
      $ /opt/SUNWscPostgreSQL/util/pgs_db_prep -f /myplace/pgs_config -e
  7. (Optional) Configure your PostgreSQL instance to listen on the logical host's TCP/IP name.

    If you want your PostgreSQL databases to listen on more than localhost, configure the listen_address parameter in the file postgresql.conf. Use a plain text editor such as vi, and set the value of listen_address to an appropriate value.


    Caution

    Caution  -  The PostgreSQL instance must listen on localhost. For additional information, see http://www.postgresql.org.


    listen_address = 'localhost,myhost'
  8. Set the security policy for the test database.

    Use a plain text editor such as vi to add the following line to the file pg_hba.conf.

    local   testdb         all                               password

    Note -  For additional information about the pg_hba.conf file, see http://www.postgresql.org.
  9. Stop the PostgreSQL database server.
    $ $PGROOT/bin/pg_ctl stop

How to Prepare Your PostgreSQL for Oracle Solaris Cluster Registration in an HA for Solaris Zones Configuration

Before You Begin

Ensure, that you have edited the pgs_config file to specify configuration parameters for the HA for PostgreSQL data service. For more information, see Specifying Configuration Parameters for the PostgreSQL Resource. Also make sure that the package directory of the HA for PostgreSQL, /opt/SUNWscPostgreSQL, is available in the target zone.

  1. As the root role, change the rights of the configuration file to be accessible for your PostgreSQL user.

    Note -  Ensure, that your pgs_config file is accessible from your zone. Otherwise, transfer the file to your zone by using appropriate methods.
    # chmod 755 /myplace/pgs_config
  2. Switch to the target zone.
    # zlogin pgsql-zone
  3. Switch to the PostgreSQL user.
    # su - zpostgr
  4. If the login shell is not the Korn shell, switch to ksh.
    % ksh
  5. Set the necessary variables.
    $ . /myplace/pgs_config
    $ export PGDATA PGPORT LD_LIBRARY_PATH
  6. If your PostgreSQL is not already running, start the PostgreSQL server.
    $ $PGROOT/bin/pg_ctl -l $PGLOGFILE start
  7. Prepare the database.
    • If you specified the password for the monitoring user in the configuration file or if you do not have a password, do the following:
      $ /opt/SUNWscPostgreSQL/util/pgs_db_prep -f /myplace/pgs_config
    • If you have a password and do not want to specify it in clear text, do the following:
      $ /opt/SUNWscPostgreSQL/util/pgs_db_prep -f /myplace/pgs_config -e
  8. (Optional) Configure your PostgreSQL instance to listen on the logical hosts TCP/IP name.

    If you want your PostgreSQL databases to listen on more than localhost, configure the listen_address parameter in the file postgresql.conf. Use a plain text editor such as vi, and set the value of listen_address to an appropriate value.


    Caution

    Caution  -  The PostgreSQL instance must listen on localhost. For additional information, see http://www.postgresql.org.


    listen_address = 'localhost,myhost'
  9. Set the security policy for the test database.

    Use a plain text editor such as vi to add the following line to the pg_hba.conf file.

    local   testdb         all                               password

    Note -  For additional information, see http://www.postgresql.org.
  10. Stop the PostgreSQL database server.
    $ $PGROOT/bin/pg_ctl stop
  11. Leave the target zone and return to the global zone.