Scroll to navigation

OCF_HEARTBEAT_PGSQL(7) OCF resource agents OCF_HEARTBEAT_PGSQL(7)

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)

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

(optional, string, no default)

stop_escalate

Number of shutdown retries (using -m fast) before resorting to -m immediate

(optional, integer, default 30)

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 dosen´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 required for replication.

(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)

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.

(optional, integer, no default)

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 shutdown retries (using -m fast) before resorting to -m immediate in slave state. This is optional for replication.

(optional, integer, default 30)

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 "ERROR".

(optional, boolean, default false)

SUPPORTED ACTIONS

This resource agent supports the following actions (operations):

start

Starts the resource. Suggested minimum timeout: 120.

stop

Stops the resource. Suggested minimum timeout: 120.

status

Performs a status check. Suggested minimum timeout: 60.

monitor

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

monitor (Master role)

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

promote

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

demote

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

notify

Suggested minimum timeout: 90.

meta-data

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

validate-all

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

methods

Suggested minimum timeout: 5.

EXAMPLE

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="30" interval="30" \
op monitor depth="0" timeout="30" interval="29" role="Master"

ms ms_pgsql p_pgsql \

meta notify="true" interleave="true"

SEE ALSO

http://www.linux-ha.org/wiki/pgsql_(resource_agent)

AUTHOR

Linux-HA contributors (see the resource agent source for information about individual authors)

03/22/2017 resource-agents 3.9.2