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.
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-host 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 STDBY_RS=PostgreSQL-standbyresource STDBY_RG= PostgreSQL-standby-resource-group STDBY_USER=PostgreSQL-standby-user STDBY_HOST=PostgreSQL-standby-host STDBY_PARFILE=PostgreSQL-standby-parameter-file STDBY_PING=Number-of packets ROLECHG_RS=PostgreSQL-rolechanger-resource SSH_PASSDIR=PostgreSQL-user-passphrase-directory
The meaning and permitted values of the keywords in the pgs_config file are as follows:
Specifies the name that you are assigning to the PostgreSQL resource. You must specify a value for this keyword.
Specifies the name of the resource group where the PostgreSQL resource will reside. You must specify a value for this keyword.
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 an HA containerconfiguration, omit this value.
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 an HA Container Configuration. If you did not register a SUNW.LogicalHostname resource, omit this value.
In an HA container and WAL file shipping with out shared storage configuration, omit this value.
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. In a WAL file shipping without shared storage configuration, omit this value.
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.
Specifies the name of the HA container to host the PostgreSQL database. Omit this value if you configure a global zone environment.
Specifies the name of the zone boot resource in an HA container configuration. Omit this value if you configure a global zone environment.
Specifies the name of the resource management project in the HA container. Omitting this value in an HA container configuration results in the default project for USER. Leave the value blank for a global zone configuration.
Specifies the name of the Solaris user who owns the PostgreSQL database. You must specify a value for this keyword.
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. |
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.
Specifies the port on which the PostgreSQL server will listen.
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.
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.
Specifies the libraries needed to start the PostgreSQL server and utilities. This parameter is optional.
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 an HA container configuration, the script type must be a valid Korn shell script.
This parameter is optional.
Specifies the name of the PostgreSQL database that will be monitored. You must specify a value for this keyword.
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.
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.
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.
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.
Specifies the name you assigned to the PostgreSQL standby resource. You must specify a value for the keyword on this primary if you configure WAL file shipping as a replacement for the shared storage.
Specifies the name of the resource group where the PostgreSQL standby resource resides. You must specify a value for this keyword on the primary if you configure WAL file shipping as a replacement for shared storage.
Specifies the name of the Solaris user who owns the PostgreSQL standby database. You must specify a value for this keyword on the primary if you configure WAL file shipping as a replacement for shared storage.
Specifies name of the cluster node that hosts the designated standby database. You must specify a value for this keyword on the primary if you configure WAL file shipping as a replacement for shared storage.
Specifies the name of the parameter file of the PostgreSQL standby resource. You must specify a value for this keyword on the primary if you configure WAL file shipping as a replacement for shared storage.
Specifies the number of packages the primary uses to ping the standby host. This value is optional and the default is five packets.
Specifies the name of the PostgreSQL Rolechanger resource. You must specify a value for the keyword on the standby host if you configure WAL file shipping as a replacement for shared storage.
Specifies the directory where a ssh passphrase is stored at registration time. This parameter is optional.
For illustration purposes, two examples for the pgs_config file are provided. The first example shows the pgs_config file for a global zone configuration and second example shows the pgs_config file for an HA container configuration.
This example shows a pgs_config file in which configuration parameters are set as follows:
The name of the PostgreSQL resource is postgres-rs.
The name of the resource group for the PostgreSQL resource is postgres-rg.
The value of the dummy port for the PostgreSQL resource is 80.
The name of the SUNW.LogicalHost resource is postgres-lh.
The name of the SUNW.HAStoragePlus resource which manages the file system for PostgreSQL is postgres-has-rs.
The parameter file will be generated in /global/postgres/pfile.
The null value for ZONE, ZONE_BT, and PROJECT indicates, that it is a global zone configuration.
The name of the Solaris user who owns PostgreSQL is postgres.
The PostgreSQL software is installed in /global/postgres/postgresql-8.1.2.
The PostgreSQL data and configuration files are installed under /global/postgres/data.
The PostgreSQL database server listens on port 5432. The probe connects by using the UNIX domain socket in the /tmp directory.
The log file for the database server is /global/postgres/logs/scinstance1.
The libraries for the PostgreSQL server are stored in the paths of the LD_LIBRARY_PATH /usr/sfw/lib:/usr/local/lib:/usr/lib:.
Additional PostgreSQL variables are set in /global/postgres/variables.ksh.
The database that will be monitored is testdb.
The user for the database monitoring is testusr.
The table testtbl will be modified to probe the condition of the database.
The password for the user testusr is testpwd.
If a connection to the database testdb fails, the probe returns with return code 10.
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
This example shows an pgs_config file in which configuration parameters are set as follows:
The name of the PostgreSQL resource is postgres-zrs.
The name of the resource group for the PostgreSQL resource is postgres-rg.
The values for the PORT variable, LH variable, and the HAS-RS variable are not set.
The parameter file will be generated in /postgres/pfile.
The PostgreSQL database server will be started in zone pgs-zone.
The boot component resource for the zone pgs-zone is named pgs-zone-rs.
The PostgreSQL database server will be started under the project pgs-project.
The name of the Solaris user who owns PostgreSQL is zpostgr.
The PostgreSQL software is installed in /postgres/postgresql-8.1.2.
The PostgreSQL data and configuration files are installed in /postgres/data.
The PostgreSQL database server listens on port 5432. The probe connects using the UNIX domain socket in /tmp.
The log file for the database server is /postgres/logs/scinstance1.
The libraries for the PostgreSQL server are stored in the paths of LD_LIBRARY_PATH /usr/sfw/lib:/usr/local/lib:/usr/lib:.
Additional PostgreSQL variables are set in /postgres/variables.ksh.
The database that will be monitored is testdb.
The user for the database monitoring is testusr.
The table testtbl will be modified to probe the condition of the database.
The password for the user testusr is testpwd.
If a connection to the database testdb fails, the probe returns with return code 10.
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