1OCF_HEARTBEAT_PGSQL(7)        OCF resource agents       OCF_HEARTBEAT_PGSQL(7)
2
3
4

NAME

6       ocf_heartbeat_pgsql - Manages a PostgreSQL database instance
7

SYNOPSIS

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

DESCRIPTION

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

SUPPORTED PARAMETERS

17       pgctl
18           Path to pg_ctl command.
19
20           (optional, string, default "/usr/bin/pg_ctl")
21
22       start_opt
23           Start options (-o start_opt in pg_ctl). "-i -p 5432" for example.
24
25           (optional, string, no default)
26
27       ctl_opt
28           Additional pg_ctl options (-w, -W etc..).
29
30           (optional, string, no default)
31
32       psql
33           Path to psql command.
34
35           (optional, string, default "/usr/bin/psql")
36
37       pgdata
38           Path to PostgreSQL data directory.
39
40           (optional, string, default "/var/lib/pgsql/data")
41
42       pgdba
43           User that owns PostgreSQL.
44
45           (optional, string, default "postgres")
46
47       pghost
48           Hostname/IP address where PostgreSQL is listening
49
50           (optional, string, no default)
51
52       pgport
53           Port where PostgreSQL is listening
54
55           (optional, integer, default 5432)
56
57       pglibs
58           Custom location of the Postgres libraries. If not set, the standard
59           location will be used.
60
61           (optional, string, default "/usr/lib")
62
63       monitor_user
64           PostgreSQL user that pgsql RA will user for monitor operations. If
65           it's not set pgdba user will be used.
66
67           (optional, string, no default)
68
69       monitor_password
70           Password for monitor user.
71
72           (optional, string, no default)
73
74       monitor_sql
75           SQL script that will be used for monitor operations.
76
77           (optional, string, default "select now();")
78
79       config
80           Path to the PostgreSQL configuration file for the instance.
81
82           (optional, string, default "/var/lib/pgsql/data/postgresql.conf")
83
84       pgdb
85           Database that will be used for monitoring.
86
87           (optional, string, default "template1")
88
89       logfile
90           Path to PostgreSQL server log output file.
91
92           (optional, string, default "/dev/null")
93
94       socketdir
95           Unix socket directory for PostgreSQL.
96
97           If you use PostgreSQL 9.3 or higher and define
98           unix_socket_directories in the postgresql.conf, then you must set
99           socketdir to determine which directory is used for psql command.
100
101           (optional, string, no default)
102
103       stop_escalate
104           Number of seconds to wait for stop (using -m fast) before resorting
105           to -m immediate
106
107           (optional, integer, default 90)
108
109       rep_mode
110           Replication mode may be set to "async" or "sync" or "slave". They
111           require PostgreSQL 9.1 or later. Once set, "async" and "sync"
112           require node_list, master_ip, and restore_command parameters,as
113           well as configuring PostgreSQL for replication (in postgresql.conf
114           and pg_hba.conf).
115
116           "slave" means that RA only makes recovery.conf before starting to
117           connect to primary which is running somewhere. It doesn't need
118           master/slave setting. It requires master_ip restore_command
119           parameters.
120
121           (optional, string, default "none")
122
123       node_list
124           All node names. Please separate each node name with a space. This
125           is optional for replication. Defaults to all nodes in the cluster
126
127           (optional, string, no default)
128
129       restore_command
130           restore_command for recovery.conf. This is required for
131           replication.
132
133           (optional, string, no default)
134
135       archive_cleanup_command
136           archive_cleanup_command for recovery.conf. This is used for
137           replication and is optional.
138
139           (optional, string, no default)
140
141       recovery_end_command
142           recovery_end_command for recovery.conf. This is used for
143           replication and is optional.
144
145           (optional, string, no default)
146
147       master_ip
148           Master's floating IP address to be connected from hot standby. This
149           parameter is used for "primary_conninfo" in recovery.conf. This is
150           required for replication.
151
152           (optional, string, no default)
153
154       repuser
155           User used to connect to the master server. This parameter is used
156           for "primary_conninfo" in recovery.conf. This is required for
157           replication.
158
159           (optional, string, default "postgres")
160
161       primary_conninfo_opt
162           primary_conninfo options of recovery.conf except host, port, user
163           and application_name. This is optional for replication.
164
165           (optional, string, no default)
166
167       restart_on_promote
168           If this is true, RA deletes recovery.conf and restarts PostgreSQL
169           on promote to keep Timeline ID. It probably makes fail-over slower.
170           It's recommended to set on-fail of promote up as fence. This is
171           optional for replication.
172
173           (optional, boolean, default false)
174
175       replication_slot_name
176           Set this option when using replication slots. Can only use lower
177           case letters, numbers and underscore for replication_slot_name.
178
179           The replication slots would be created for each node, with the name
180           adding the node name as postfix. For example, replication_slot_name
181           is "sample" and 2 slaves which are "node1" and "node2" connect to
182           their slots, the slots names are "sample_node1" and "sample_node2".
183           If the node name contains a upper case letter, hyphen and dot,
184           those characters will be converted to a lower case letter or an
185           underscore. For example, Node-1.example.com to node_1_example_com.
186
187           pgsql RA doesn't monitor and delete the replication slot. When the
188           slave node has been disconnected in failure or the like, execute
189           one of the following manually. Otherwise it may eventually cause a
190           disk full because the master node will continue to accumulate the
191           unsent WAL. 1. recover and reconnect the slave node to the master
192           node as soon as possible. 2. delete the slot on the master node by
193           following psql command. $ select
194           pg_drop_replication_slot('replication_slot_name');
195
196           (optional, string, no default)
197
198       tmpdir
199           Path to temporary directory. This is optional for replication.
200
201           (optional, string, default "/var/lib/pgsql/tmp")
202
203       xlog_check_count
204           Number of checks of xlog on monitor before promote. This is
205           optional for replication.
206
207           Note: For backward compatibility, the terms are unified with
208           PostgreSQL 9. If you are using PostgreSQL 10 or later, replace
209           "xlog" with "wal". Likewise, replacing "location" with "lsn".
210
211           (optional, integer, default 3)
212
213       crm_attr_timeout
214           The timeout of crm_attribute forever update command. Default value
215           is 5 seconds. This is optional for replication.
216
217           (optional, integer, default 5)
218
219       stop_escalate_in_slave
220           Number of seconds to wait for stop (using -m fast) before resorting
221           to -m immediate in slave state. This is optional for replication.
222
223           (optional, integer, default 90)
224
225       check_wal_receiver
226           If this is true, RA checks wal_receiver process on monitor and
227           notifies its status using "(resource name)-receiver-status"
228           attribute. It's useful for checking whether PostgreSQL (hot
229           standby) connects to primary. The attribute shows status as
230           "normal" or "normal (master)" or "ERROR". Note that if you
231           configure PostgreSQL as master/slave resource, then wal receiver is
232           not running in the master and the attribute shows status as "normal
233           (master)" consistently because it is normal status.
234
235           (optional, boolean, default false)
236

SUPPORTED ACTIONS

238       This resource agent supports the following actions (operations):
239
240       start
241           Starts the resource. Suggested minimum timeout: 120s.
242
243       stop
244           Stops the resource. Suggested minimum timeout: 120s.
245
246       status
247           Performs a status check. Suggested minimum timeout: 60s.
248
249       monitor
250           Performs a detailed status check. Suggested minimum timeout: 30s.
251           Suggested interval: 30s.
252
253       monitor (Master role)
254           Performs a detailed status check. Suggested minimum timeout: 30s.
255           Suggested interval: 29s.
256
257       promote
258           Promotes the resource to the Master role. Suggested minimum
259           timeout: 120s.
260
261       demote
262           Demotes the resource to the Slave role. Suggested minimum timeout:
263           120s.
264
265       notify
266           Suggested minimum timeout: 90s.
267
268       meta-data
269           Retrieves resource agent metadata (internal use only). Suggested
270           minimum timeout: 5s.
271
272       validate-all
273           Performs a validation of the resource configuration. Suggested
274           minimum timeout: 5s.
275
276       methods
277           Suggested minimum timeout: 5s.
278

EXAMPLE CRM SHELL

280       The following is an example configuration for a pgsql resource using
281       the crm(8) shell:
282
283           primitive p_pgsql ocf:heartbeat:pgsql \
284             op monitor depth="0" timeout="30s" interval="30s" \
285             op monitor depth="0" timeout="30s" interval="29s" role="Master"
286
287           ms ms_pgsql p_pgsql \
288             meta notify="true" interleave="true"
289

EXAMPLE PCS

291       The following is an example configuration for a pgsql resource using
292       pcs(8)
293
294           pcs resource create p_pgsql ocf:heartbeat:pgsql \
295             op monitor depth="0" timeout="30s" interval="30s" \
296             op monitor depth="0" timeout="30s" interval="29s" role="Master" --master
297

SEE ALSO

299       http://clusterlabs.org/
300

AUTHOR

302       ClusterLabs contributors (see the resource agent source for information
303       about individual authors)
304
305
306
307resource-agents UNKNOWN           03/09/2020            OCF_HEARTBEAT_PGSQL(7)
Impressum