无法在 CentOS 7 上使用 Corosync/Pacemaker 启动 PostgreSQL 复制资源

无法在 CentOS 7 上使用 Corosync/Pacemaker 启动 PostgreSQL 复制资源

我有 2 个 VM 节点集群。Postgres 通常在主从复制模式下工作 - 已测试。

添加 pgsql 作为 pcs 资源时出现错误:来自日志文件

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

我已执行的命令:

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

如果我做错了什么,请指教

答案1

该错误中的问题相当明显:

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

您需要为 rpgsql 原语配置 MS(主/从)类型资源。请参阅文档中的第二个示例,以将其应用于已创建的资源。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

为方便起见,此处粘贴示例:

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

相关内容