Go to main content

Oracle® Solaris Cluster Data Service for PostgreSQL Guide

Exit Print View

Updated: June 2017
 
 

Specifying Configuration Parameters for the PostgreSQL Resource

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 the copied pgs_config file.


Note -  This configuration file needs to be accessible from the zone where the PostgreSQL software 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:

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 an HA for Solaris Zonesconfiguration, 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 Non-Global Zone to Run PostgreSQL in an HA for Solaris Zones Configuration. If you did not register a SUNW.LogicalHostname resource, omit this value.

In a configuration using HA for Solaris Zones and WAL file shipping without shared storage, 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 the Global Zone. Dependencies to additional resources can be specified here. They must be separated by a comma. In a configuration using WAL file shipping without shared storage, omit this value.

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 HA for Solaris Zones configuration 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 an HA for Solaris Zones 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 HA for Solaris Zones. Omitting this value in an HA for Solaris Zones 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 Oracle 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 Oracle Solaris software.

/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.conffile 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 an HA for Solaris Zones 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 or the stored password must be encrypted.

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 HA for PostgreSQL Fault Monitor.

STDBY_RS=PostgreSQL-standbyresourse

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.

STDBY_RG=PostgreSQL-standby-resourse-group

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.

STDBY_USER=PostgreSQL-standby-resourse-user

Specifies the name of the Oracle 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.

STDBY_HOST=PostgreSQL-standby-host

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.

STDBY_PARFILE=PostgreSQL-standby-parameterfile

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.

STDBY_PING=Number of packets

Specifies the number of packages the primary uses to ping the standby host. This value is optional and the default is five packets.

ROLECHG_RS=PostgreSQL-rolechanger-resource

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.

SSH_PASSDIR=PostgreSQL-user-passphrase-directory

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 for Solaris Zones configuration.

Example 1  Sample pgs_config File for a Global Zone 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.LogicalHostname 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 Oracle 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, although it is not stored in the configuration file.

  • 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=
NOCONRET=10
Example 2  Sample pgs_config File for an HA for Solaris Zones Configuration

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 Oracle 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, although it is not stored in the configuration file.

  • 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=
NOCONRET=10