Postgresql – Can not start PostgreSQL replication resource with Corosync/Pacemaker on CentOS 7

pacemakerpostgresql

I have 2 VM nodes cluster. Postgres is working in master-slave replication mode normally – Tested this.

While adding pgsql as pcs resource it gives error: From log file

care1 pgsql(pgsql)[30160]: ERROR: Replication(rep_mode=async or sync) requires Master/Slave configuration.

Commands which I have executed:

pcs property set no-quorum-policy="ignore"
pcs property set stonith-enabled="false"
pcs resource defaults resource-stickiness="INFINITY"
pcs resource defaults migration-threshold="1"

pcs resource create vip-master IPaddr2 \
   ip="192.168.1.59" nic="enp0s3" \
   cidr_netmask="24" \
   op start   timeout="60s" interval="0s"  on-fail="restart" \
   op monitor timeout="60s" interval="10s" on-fail="restart" \
   op stop    timeout="60s" interval="0s"  on-fail="block"

pcs resource create rpgsql pgsql \
   pgctl="/usr/pgsql-9.5/bin/pg_ctl" \
   psql="/usr/pgsql-9.5/bin/psql" \
   pgdata="/var/lib/pgsql/9.5/data/" \
   rep_mode="sync" \
   node_list="care2 care1" \
   restore_command="cp /var/lib/pgsql/archive/%f %p" \
   primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" \
   master_ip="192.168.1.59" \
   restart_on_promote="false" \
   op start   timeout="60s" interval="0s"  on-fail="restart" \
   op monitor timeout="60s" interval="4s" on-fail="restart" \
   op monitor timeout="60s" interval="3s"  on-fail="restart" role="Master" \
   op promote timeout="60s" interval="0s"  on-fail="restart" \
   op demote  timeout="60s" interval="0s"  on-fail="stop" \
   op stop    timeout="60s" interval="0s"  on-fail="block" \
   op notify  timeout="60s" interval="0s"

pcs status

[root@care1 data]# pcs status
Cluster name: pcs_cluster
Stack: corosync
Current DC: care1 (version 1.1.15-11.el7_3.2-e174ec8) - partition with quorum
Last updated: Wed Feb  8 10:21:04 2017      Last change: Wed Feb  8 10:08:25 2017 by root via cibadmin on care1

2 nodes and 3 resources configured: 1 resource DISABLED and 0 BLOCKED from being started due to failures

Online: [ care1 care2 ]

Full list of resources:

 WebServer  (ocf::heartbeat:apache):    Stopped (disabled)
 vip-master (ocf::heartbeat:IPaddr2):   Started care1
 pgsql  (ocf::heartbeat:pgsql): Stopped

Failed Actions:
* pgsql_start_0 on care2 'not configured' (6): call=62, status=complete, exitreason='Replication(rep_mode=async or sync) requires Master/Slave configuration.',
    last-rc-change='Wed Feb  8 10:08:26 2017', queued=0ms, exec=146ms


Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/enabled

Please advice if I am doing anything wrong

Best Answer

The issue is fairly clear within the error:

ERROR: Replication(rep_mode=async or sync) requires Master/Slave configuration.

You will need to configure a MS (Master/Slave) type resource for the rpgsql primitive. See the second example in the documentation to apply this to an already created resource. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Configuring_the_Red_Hat_High_Availability_Add-On_with_Pacemaker/s1-multistateresource-HAAR.html

Example pasted here for convenience:

pcs resource master master/slave_name resource_id|group_name [master_options]