Sun Cluster Data Service for PostgreSQL Guide for Solaris OS

Verifying the Installation and Configuration of PostgreSQL

Before you install the Sun Cluster HA for PostgreSQL packages, verify that each PostgreSQL instance that you created is correctly configured to run in a cluster. The instance is the PostgreSQL database cluster together with the associated postmaster processes. This verification does not confirm that the PostgreSQL databases are highly available because the Sun Cluster HA for PostgreSQL data service is not yet configured.

ProcedureHow to Verify the Installation and Configuration of PostgreSQL

Perform this procedure for each PostgreSQL instance that you created in Installing and Configuring PostgreSQL. During the verification you will complete the PostgreSQL postinstallation steps.

Before You Begin

Determine whether you are in a local zone or in a global zone. If you are in a failover zone, use /postgres instead of /global/postgres for your directory prefix in this procedure.

  1. Switch to the PostgreSQL user if necessary.


    # su - postgres
    
  2. (Optional) Set the PATH and LD_LIBRARY_PATH variables.


    $ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
    $ export PATH
    $ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
    $ export LD_LIBRARY_PATH
    
  3. Set the PGDATA variable.

    The PGDATA variable points to the directory where the PostgreSQL database cluster is installed. The PostgreSQL database cluster is a directory that contains the configuration and the data files for all the databases.


    $ PGDATA=/global/postgres/data
    $ export PGDATA
    
  4. Create the data directory and the logs directory.


    $ mkdir /global/postgres/data
    $ mkdir /global/postgres/logs
    
  5. Initialize the PostgreSQL cluster.


    $ cd ~/postgres-version
    $ ./bin/initdb -D $PGDATA
    
  6. Start the PostgreSQL database server.


    $ ./bin/pg_ctl -l /global/postgres/logs/firstlog start
    
  7. Create and delete a test database.


    $ ./bin/createdb test
    $ ./bin/dropdb test
    
  8. If you are in a non global zone, leave this zone and return to the target zone.