table of contents
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
(optional, string, default "/usr/bin/pg_ctl")
start_opt
(optional, string, no default)
ctl_opt
(optional, string, no default)
psql
(optional, string, default "/usr/bin/psql")
pgdata
(optional, string, default "/var/lib/pgsql/data")
pgdba
(optional, string, default "postgres")
pghost
(optional, string, no default)
pgport
(optional, integer, default 5432)
pglibs
(optional, string, default "/usr/lib")
monitor_user
(optional, string, no default)
monitor_password
(optional, string, no default)
monitor_sql
(optional, string, default "select now();")
config
(optional, string, default "/var/lib/pgsql/data/postgresql.conf")
pgdb
(optional, string, default "template1")
logfile
(optional, string, default "/dev/null")
socketdir
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
(optional, integer, default 90)
rep_mode
"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
(optional, string, no default)
restore_command
(optional, string, no default)
archive_cleanup_command
(optional, string, no default)
recovery_end_command
(optional, string, no default)
master_ip
(optional, string, no default)
repuser
(optional, string, default "postgres")
primary_conninfo_opt
(optional, string, no default)
restart_on_promote
(optional, boolean, default false)
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 repliation 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
(optional, string, default "/var/lib/pgsql/tmp")
xlog_check_count
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
(optional, integer, default 5)
stop_escalate_in_slave
(optional, integer, default 90)
check_wal_receiver
(optional, boolean, default false)
SUPPORTED ACTIONS¶
This resource agent supports the following actions (operations):
start
stop
status
monitor
monitor (Master role)
promote
demote
notify
meta-data
validate-all
methods
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="Master"
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 depth="0" timeout="30s" interval="30s" \
op monitor depth="0" timeout="30s" interval="29s" role="Master" --master
SEE ALSO¶
AUTHOR¶
ClusterLabs contributors (see the resource agent source for information about individual authors)
03/19/2024 | resource-agents UNKNOWN |