Provided by: resource-agents-base_4.15.1-2ubuntu3_all bug

NAME

       ocf_heartbeat_pgsql - Manages a PostgreSQL database instance

SYNOPSIS

       pgsql [start | stop | status | monitor | promote | demote | meta-data | validate-all]

DESCRIPTION

       Resource script for PostgreSQL. It manages a PostgreSQL as an HA resource.

SUPPORTED PARAMETERS

       pgctl
           Path to pg_ctl command.

           (optional, string, default "/usr/bin/pg_ctl")

       start_opt
           Start options (-o start_opt in pg_ctl). "-i -p 5432" for example.

           (optional, string, no default)

       ctl_opt
           Additional pg_ctl options (-w, -W etc..).

           (optional, string, no default)

       psql
           Path to psql command.

           (optional, string, default "/usr/bin/psql")

       pgdata
           Path to PostgreSQL data directory.

           (optional, string, default "/var/lib/pgsql/data")

       pgdba
           User that owns PostgreSQL.

           (optional, string, default "postgres")

       pghost
           Hostname/IP address where PostgreSQL is listening

           (optional, string, no default)

       pgport
           Port where PostgreSQL is listening

           (optional, integer, default 5432)

       pglibs
           Custom location of the Postgres libraries. If not set, the standard location will be
           used.

           (optional, string, default "/usr/lib")

       monitor_user
           PostgreSQL user that pgsql RA will user for monitor operations. If it's not set pgdba
           user will be used.

           (optional, string, no default)

       monitor_password
           Password for monitor user.

           (optional, string, no default)

       monitor_sql
           SQL script that will be used for monitor operations.

           (optional, string, default "select now();")

       config
           Path to the PostgreSQL configuration file for the instance.

           (optional, string, default "/var/lib/pgsql/data/postgresql.conf")

       pgdb
           Database that will be used for monitoring.

           (optional, string, default "template1")

       logfile
           Path to PostgreSQL server log output file.

           (optional, string, default "/dev/null")

       socketdir
           Unix socket directory for PostgreSQL.

           If you use PostgreSQL 9.3 or higher and define unix_socket_directories in the
           postgresql.conf, then you must set socketdir to determine which directory is used for
           psql command.

           (optional, string, no default)

       stop_escalate
           Number of seconds to wait for stop (using -m fast) before resorting to -m immediate

           (optional, integer, default 90)

       rep_mode
           Replication mode may be set to "async" or "sync" or "slave". They require PostgreSQL
           9.1 or later. Once set, "async" and "sync" require node_list, master_ip, and
           restore_command parameters,as well as configuring PostgreSQL for replication (in
           postgresql.conf and pg_hba.conf).

           "slave" means that RA only makes recovery.conf before starting to connect to primary
           which is running somewhere. It doesn't need master/slave setting. It requires
           master_ip restore_command parameters.

           (optional, string, default "none")

       node_list
           All node names. Please separate each node name with a space. This is optional for
           replication. Defaults to all nodes in the cluster

           (optional, string, no default)

       restore_command
           restore_command for recovery.conf. This is required for replication.

           (optional, string, no default)

       archive_cleanup_command
           archive_cleanup_command for recovery.conf. This is used for replication and is
           optional.

           (optional, string, no default)

       recovery_end_command
           recovery_end_command for recovery.conf. This is used for replication and is optional.

           (optional, string, no default)

       master_ip
           Master's floating IP address to be connected from hot standby. This parameter is used
           for "primary_conninfo" in recovery.conf. This is required for replication.

           (optional, string, no default)

       repuser
           User used to connect to the master server. This parameter is used for
           "primary_conninfo" in recovery.conf. This is required for replication.

           (optional, string, default "postgres")

       primary_conninfo_opt
           primary_conninfo options of recovery.conf except host, port, user and
           application_name. This is optional for replication.

           (optional, string, no default)

       restart_on_promote
           If this is true, RA deletes recovery.conf and restarts PostgreSQL on promote to keep
           Timeline ID. It probably makes fail-over slower. It's recommended to set on-fail of
           promote up as fence. This is optional for replication.

           (optional, boolean, default false)

       replication_slot_name
           Set this option when using replication slots. Can only use lower case letters, numbers
           and underscore for replication_slot_name.

           The replication slots would be created for each node, with the name adding the node
           name as postfix. For example, replication_slot_name is "sample" and 2 slaves which are
           "node1" and "node2" connect to their slots, the slots names are "sample_node1" and
           "sample_node2". If the node name contains a upper case letter, hyphen and dot, those
           characters will be converted to a lower case letter or an underscore. For example,
           Node-1.example.com to node_1_example_com.

           pgsql RA doesn't monitor and delete the replication slot. When the slave node has been
           disconnected in failure or the like, execute one of the following manually. Otherwise
           it may eventually cause a disk full because the master node will continue to
           accumulate the unsent WAL. 1. recover and reconnect the slave node to the master node
           as soon as possible. 2. delete the slot on the master node by following psql command.
           $ select pg_drop_replication_slot('replication_slot_name');

           (optional, string, no default)

       tmpdir
           Path to temporary directory. This is optional for replication.

           (optional, string, default "/var/lib/pgsql/tmp")

       xlog_check_count
           Number of checks of xlog on monitor before promote. This is optional for replication.

           Note: For backward compatibility, the terms are unified with PostgreSQL 9. If you are
           using PostgreSQL 10 or later, replace "xlog" with "wal". Likewise, replacing
           "location" with "lsn".

           (optional, integer, default 3)

       crm_attr_timeout
           The timeout of crm_attribute forever update command. Default value is 5 seconds. This
           is optional for replication.

           (optional, integer, default 5)

       stop_escalate_in_slave
           Number of seconds to wait for stop (using -m fast) before resorting to -m immediate in
           slave state. This is optional for replication.

           (optional, integer, default 90)

       check_wal_receiver
           If this is true, RA checks wal_receiver process on monitor and notifies its status
           using "(resource name)-receiver-status" attribute. It's useful for checking whether
           PostgreSQL (hot standby) connects to primary. The attribute shows status as "normal"
           or "normal (master)" or "ERROR". Note that if you configure PostgreSQL as master/slave
           resource, then wal receiver is not running in the master and the attribute shows
           status as "normal (master)" consistently because it is normal status.

           (optional, boolean, default false)

SUPPORTED ACTIONS

       This resource agent supports the following actions (operations):

       start
           Starts the resource. Suggested minimum timeout: 120s.

       stop
           Stops the resource. Suggested minimum timeout: 120s.

       status
           Performs a status check. Suggested minimum timeout: 60s.

       monitor
           Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval:
           30s.

       monitor (Promoted role)
           Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval:
           29s.

       promote
           Promotes the resource to the Master role. Suggested minimum timeout: 120s.

       demote
           Demotes the resource to the Slave role. Suggested minimum timeout: 120s.

       notify
           Suggested minimum timeout: 90s.

       meta-data
           Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s.

       validate-all
           Performs a validation of the resource configuration. Suggested minimum timeout: 5s.

       methods
           Suggested minimum timeout: 5s.

EXAMPLE CRM SHELL

       The following is an example configuration for a pgsql resource using the crm(8) shell:

           primitive p_pgsql ocf:heartbeat:pgsql \
             op monitor depth="0" timeout="30s" interval="30s" \
             op monitor depth="0" timeout="30s" interval="29s" role="Promoted"

           ms ms_pgsql p_pgsql \
             meta notify="true" interleave="true"

EXAMPLE PCS

       The following is an example configuration for a pgsql resource using pcs(8)

           pcs resource create p_pgsql ocf:heartbeat:pgsql \
             op monitor OCF_CHECK_LEVEL="0" timeout="30s" interval="30s" \
             op monitor OCF_CHECK_LEVEL="0" timeout="30s" interval="29s" role="Promoted" promotable

SEE ALSO

       http://clusterlabs.org/

AUTHOR

       ClusterLabs contributors (see the resource agent source for information about individual
       authors)