Sun Cluster Data Service for PostgreSQL Guide for Solaris OS

Specifying Configuration Parameters for the PostgreSQL Resource

Sun Cluster HA for PostgreSQL provides a script that automates the process of configuring the PostgreSQL resource. This script obtains configuration parameters from the pgs_config file. A template for this file is in the /opt/SUNWscPostgreSQL/util directory. To specify configuration parameters for the PostgreSQL resource, copy the pgs_config file to another directory and edit this pgs_config file.


Note –

This configuration file needs to be accessible from the zone where the PostgreSQL is installed.


Each configuration parameter in the pgs_config file is defined as a keyword-value pair. The pgs_config file already contains the required keywords and equals signs. For more information, see Listing of pgs_config. When you edit the /myplace/pgs_config file, add the required value to each keyword.

The keyword-value pairs in the pgs_config file are as follows:

RS=PostgreSQL-resource
RG=PostgreSQL-resource-group
PORT=80
LH=PostgreSQL-logical-hostname-resource-name
HAS_RS=PostgreSQL-has-resource
PFILE=pgsql-parameter-file
ZONE=pgsql-zone
ZONE_BT=pgsql-zone-rs
PROJECT=pgsql-zone-project
USER=pgsql-user
PGROOT=pgsql-root-directory
PGDATA=pgsql-data-directory
PGPORT=pgsql-port
PGHOST=pgsql-port
PGLOGFILE=pgsql-log-file
LD_LIBRARY_PATH=pgsql-ld-library-path
ENVSCRIPT=pgsql-environment-script
SCDB=pgsql-mon-db
SCUSER=pgsql-mon-user
SCTABLE=pgsql-mon-table
SCPASS=pgsql-mon-pwd
NOCONRET=pgsql-noconn-rtcode

The meaning and permitted values of the keywords in the pgs_config file are as follows:

RS=PostgreSQL-resource

Specifies the name that you are assigning to the PostgreSQL resource. You must specify a value for this keyword.

RG=PostgreSQL-resource-group

Specifies the name of the resource group where the PostgreSQL resource will reside. You must specify a value for this keyword.

PORT=80

In a global zone configuration specifies the value of a dummy port only if you specified the LH value for the PostgreSQL resource. This variable is used only at registration time. If you will not specify an LH, omit this value.

In a failover zone configuration, omit this value.

LH=PostgreSQL-logical-hostname-resource-name

In a global zone configuration specifies the name of the SUNW.LogicalHostName resource for the PostgreSQL resource. This name must be the SUNW.LogicalHostname resource name you assigned when you created the resource in How to Enable a Zone to Run PostgreSQL in a Failover Zone Configuration. If you did not register a SUNW.LogicalHostname resource, omit this value.

In a failover zone configuration, omit this value.

HAS_RS=PostgreSQL-has-resource

Specifies the names of resources on which your PostgreSQL will depend, for example, the SUNW.HAStoragePlus resource, for the PostgreSQL resource. This name must be the SUNW.HAStoragePlus resource name that you assigned when you created the resource in How to Enable a PostgreSQL Database to Run in a Global Zone Configuration. Dependencies to additional resources can be specified here. They must be separated by a comma.

PFILE=pgsql-parameter-file

Specifies the name of the parameter file where the PostgreSQL specific parameters of the PostgreSQL resource are stored. This file is automatically created at registration time. You must specify a value for this keyword.

ZONE=pgsql-zonename

Specifies the name of the failover zone to host the PostgreSQL database. Omit this value if you configure a global zone environment.

ZONE_BT=pgsql-zone-rs

Specifies the name of the zone boot resource in a failover zone configuration. Omit this value if you configure a global zone environment.

PROJECT=pgsql-zone-project

Specifies the name of the resource management project in the failover zone. Omitting this value in a failover zone configuration results in the default project for USER. Leave the value blank for a global zone configuration.

USER=pgsql-user

Specifies the name of the Solaris user who owns the PostgreSQL database. You must specify a value for this keyword.

PGROOT=pgsql-root-directory

Specifies the name of the directory in which PostgreSQL is installed. For example, if PostgreSQL version 8.1.2 is installed in/global/postgres/postgresql-8.1.2, the variable PGROOT needs to be set to /global/postgres/postgresql-8.1.2. A valid PGROOT variable contains the file pg_ctl, which is located in its subdirectory bin. You must specify a value for this keyword.

Examples for PGROOT:

/usr

Root path for PostgreSQL shipped with Solaris OS. 

/usr/local/psql

Root path for the PostgreSQL build without a prefix. 

/your-path

Fully customized root path for PostgreSQL. This is where to place the binaries on the shared storage. A known convention is /path/postgresql-x.y.z.

PGDATA=pgsql-data-directory

Specifies the name of the directory where the “PostgreSQL data cluster” is initialized. This directory is where the data directories and at least the postgresql.conf file are located. You must specify a value for this keyword.

PGPORT=pgsql-port

Specifies the port on which the PostgreSQL server will listen.

PGHOST=pgsql-host

Specifies the hostname or directory that is used by the probe. If PGHOST is a hostname, the hostname is used by the probe to connect to the database. If PGHOST is a directory, the probe expects the UNIX domain socket in this directory to establish its connection. The PGHOST variable is referenced only by the probe and the database must be configured according to this setting.

PGLOGFILE=pgsql-log-file

Specifies the name of the log file of PostgreSQL. All server messages will be found in this file. You must specify a value for this keyword.

LD_LIBRARY_PATH=pgsql-ld-library-path

Specifies the libraries needed to start the PostgreSQL server and utilities. This parameter is optional.

ENVSCRIPT=pgsql-environment-script

Specifies the name of a script to source PostgreSQL—specific environment variables. In a global zone configuration, the script type is either C shell or Korn shell, according to the login shell of the PostgreSQL user. In a failover zone configuration, the script type must be a valid Korn shell script.

This parameter is optional.

SCDB=pgsql-mon-db

Specifies the name of the PostgreSQL database that will be monitored. You must specify a value for this keyword.

SCUSER=pgsql-mon-user

Specifies the name of the PostgreSQL database user, which is needed to monitor the condition of the database. This user will be created during the installation process. You must specify a value for this keyword.

SCTABLE=pgsql-mon-table

Specifies the name of the table that will be modified to monitor the health of the PostgreSQL application. This table will be created during the installation process. You must specify a value for this keyword.

SCPASS=pgsql-mon-pwd

Specifies the password for SCUSER. If no password is specified, the user set by SCUSER needs to be allowed to log in from the localhost without a password challenge.

This parameter is optional.

NOCONRET=pgs-noconn-rtcode

Specifies the value below 100 of the return code for failed database connections. For more information, seeTuning the Sun Cluster HA for PostgreSQL Fault Monitor

For illustration purposes, two examples for the pgs_config file are provided. Example 1 shows the pgs_config file for a global zone configuration. Example shows the pgs_config file for a failover zone configuration.


Example 1 Sample pgs_config File for a Global Zone of Zone Configuration

This example shows a pgs_config file in which configuration parameters are set as follows:

RS=postgres-rs
RG=postgres-rg
PORT=80
LH=postgres-lh
HAS_RS=postgres-has-rs
PFILE=/global/postgres/pfile
ZONE=
ZONE_BT=
PROJECT=
USER=postgres
PGROOT=/global/postgres/postgresql-8.1.2
PGDATA=/global/postgres/data
PGPORT=5432
PGHOST=
PGLOGFILE=/global/postgres/logs/scinstance1
LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
ENVSCRIPT=/global/postgres/variables.ksh
SCDB=testdb
SCUSER=testusr
SCTABLE=testtbl
SCPASS=testpwd
NOCONRET=10


Example 2 Sample pgs_config File for a Failover Zone Configuration

This example shows an pgs_config file in which configuration parameters are set as follows:

RS=postgres-zrs
RG=postgres-rg
PORT=
LH=
HAS_RS=
PFILE=/postgres/pfile
ZONE=pgs-zone
ZONE_BT=pgs-zone-rs
PROJECT=pgs-project
USER=zpostgr
PGROOT=/postgres/potgresql-8.1.2
PGDATA=/postgres/data
PGPORT=5432
PGHOST=
PGLOGFILE=/postgres/logs/scinstance1
LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
ENVSCRIPT=/postgres/variables.ksh
SCDB=testdb
SCUSER=testusr
SCTABLE=testtbl
SCPASS=testpwd
NOCONRET=10