OCF_HEARTBEAT_PGSQLMS(7)

NAME
ocf_heartbeat_pgsqlms - A PostgreSQL multi-state resource agent for Pacemaker

SYNOPSIS
pgsqlms [start | stop | monitor | promote | demote | notify | reload | methods | meta-data | validate-all]

DESCRIPTION
Resource script for PostgreSQL in replication. It manages PostgreSQL servers using streaming replication as an HA resource.

SUPPORTED PARAMETERS

pgdata
    Location of the PGDATA of your instance

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

pghost
    The socket directory or IP address to use to connect to the local instance

    (optional, string, default "/tmp")

pgport
    The port to connect to the local instance

    (optional, integer, default "5432")

bindir
    Location of the PostgreSQL binaries.

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

system_user
    The system owner of your instance's process

    (optional, string, default "postgres")

recovery_template
    The local template that will be copied as the "PGDATA/recovery.conf" file. This template file must exists on all node.

    (optional, string, default "$PGDATA/recovery.conf.pcmk")

maxlag
    Maximum lag allowed on a standby before we set a negative master score on it. The calculation is based on the difference between the current xlog location on the master and the write location on the standby.

    (optional, integer, default "0" disables this feature)

datadir
    Path to the directory set in "data_directory" from your postgresql.conf file. This parameter has same default than PostgreSQL itself: the "pgdata" parameter value.

    Unless you have a special PostgreSQL setup and you understand this parameter, ignore it

    (optional, string, default to the value of "pgdata")

start_opts
    Additional arguments given to the postgres process on startup. See "postgres --help" for available options. Useful when the postgresql.conf file is not in the data directory (PGDATA), eg.:

      -c config_file=/etc/postgresql/9.3/main/postgresql.conf

    (optinal, string, default "")

SUPPORTED ACTIONS
This resource agent supports the following actions (operations):

start
    Starts the resource. Suggested minimum timeout: 60.

stop
    Stops the resource. Suggested minimum timeout: 60.

reload
    Suggested minimum timeout: 20.

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

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

monitor (Master role)
    Performs a detailed status check. Suggested minimum timeout: 10. Suggested interval: 15.

monitor (Slave role)
    Performs a detailed status check. Suggested minimum timeout: 10. Suggested interval: 16.

notify
    Suggested minimum timeout: 60

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

methods
    Suggested minimum timeout: 5.

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

EXAMPLE CRM SHELL
The following is an example configuration for a pgsqlms resource using the crm(8) shell:

  primitive pgsqld pgsqlms                                                 \
    params pgdata="/var/lib/postgresql/9.6/main"                           \
      bindir="/usr/lib/postgresql/9.6/bin"                                 \
      pghost="/var/run/postgresql"                                         \
      recovery_template="/etc/postgresql/9.6/main/recovery.conf.pcmk"      \
      start_opts="-c config_file=/etc/postgresql/9.6/main/postgresql.conf" \
    op start timeout=60s                                                   \
    op stop timeout=60s                                                    \
    op promote timeout=30s                                                 \
    op demote timeout=120s                                                 \
    op monitor interval=15s timeout=10s role="Master"                      \
    op monitor interval=16s timeout=10s role="Slave"                       \
    op notify timeout=60s

  ms pgsql-ha pgsqld meta notify=true

EXAMPLE PCS
The following is an example configuration for a pgsqlms resource using pcs(8):

  pcs resource create pgsqld ocf:heartbeat:pgsqlms            \
    bindir=/usr/pgsql-9.6/bin pgdata=/var/lib/pgsql/9.6/data  \
    op start timeout=60s                                      \
    op stop timeout=60s                                       \
    op promote timeout=30s                                    \
    op demote timeout=120s                                    \
    op monitor interval=15s timeout=10s role="Master"         \
    op monitor interval=16s timeout=10s role="Slave"          \
    op notify timeout=60s --master notify=true

SEE ALSO
http://clusterlabs.org/

AUTHOR
Jehan-Guillaume de Rorthais and Mael Rimbault.