centos7 - Pacemaker 与主从资源的意外行为 (Postgresql)

标签 centos7 postgresql-9.3 pacemaker corosync

环境:

我在 Cent OS 7.5 上使用 Pacemaker (pacemaker-1.1.19-8.el7_6.1.x86_64) 和 corosync(corosync-2.4.3-2.el7_5.1.x86_64)。 Postgresql 版本为 9.3.21 我有两个具有节点名称的节点集群:failover1 和 failover2。 我有一个 Postgresql9 的克隆资源。以下是相同的 CIB

pcs resource create Postgresql9 ocf:heartbeat:pgsql \
        pgctl="/usr/pgsql-9.3/bin/pg_ctl" psql="/usr/pgsql-9.3/bin/psql" pgdata="/var/lib/pgsql/9.3/data/" start_opt="-p 5432" rep_mode="async" node_list="failover1 failover2" restore_command="" primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" master_ip="10.10.17.165" restart_on_promote="true" \
        op monitor interval="20s" role="Slave" timeout="100s" \
        op monitor interval="10s" role="Master" timeout="100s" \
        op start interval="0" timeout="250s" \
        op promote interval="0" timeout="70s" \
        op stop interval="0" timeout="70s" \
        op demote interval="0" timeout="200s" \
        op notify interval="0" timeout="200s" \
        meta failure-timeout="2000s" \
        meta migration-threshold="3"
pcs resource master mspostgres Postgresql9 master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true" migration-threshold="3" target-role="Started"
pcs constraint location mspostgres prefers failover1=90
pcs constraint location mspostgres prefers failover2=80
pcs constraint colocation add DBClusterIP with Master mspostgres score=INFINITY
pcs constraint order stop DBClusterIP  then demote mspostgres  kind=Optional symmetrical=false

pcs property set cluster-recheck-interval=5min
pcs property set stonith-enabled=false
pcs property set no-quorum-policy=ignore
pcs resource defaults migration-threshold=3
pcs property set placement-strategy=balanced
pcs property set stop-all-resources=false
pcs resource defaults failure-timeout=2000
pcs resource defaults resource-stickiness=100
pcs resource op defaults on-fail=restart

问题: 我能够在 failover1 上以 master 身份运行此资源,在 failover2 上以 slave 身份运行此资源。当使用 pcs resource ban 命令在 failover2 上移动 master 时,我得到了想要的结果。 当我重新启动机器 failover1 时,Failover2 成为资源 Postgresql9 的主资源,但是当 Failover1 机器启动时,该资源在两台机器上都成为从属资源,并且没有一个被提升。

预期情况: 理想情况下,启动 Failover1 不应影响已经运行的资源 Postgresql9 Master。

如果节点重新联机,请帮助我了解集群的行为。

最佳答案

事实证明 Postgres 服务是从 systemctl 启用的,因此当服务器启动时 systemctl 启动 Postgres 服务,并且因为这个 _monitor() 在资源代理返回 $OCF_RUNNING_MASTER 并更改其他节点上 Postgres-data-status 的状态。

关于centos7 - Pacemaker 与主从资源的意外行为 (Postgresql),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54928336/

相关文章:

docker - 如何启动MariaDB并保持其运行基于Centos的Docker镜像

postgresql - 从局域网访问 PostgreSQL 服务器

postgresql - 错误 : a column definition list is required for functions in dblink using PostgreSQL 9. 3

postgresql - pg_upgradecluster 花费太多时间(165GB 数据库大约需要 8 小时)有什么解决方法吗?

r - 如何在 Linux (Red Hat/CentOS) 上更新到特定的 R 版本,同时保持以前的版本?

postgresql - 提高PostgreSQL的数据插入速度

cluster-computing - 无法启动 Corosync 集群引擎

cluster-computing - 起搏器 corosync 服务被忽略

node.js - 如何在没有 sudo 权限的 CentOS 上安装 Node.js

sql-server - SQL 2017 Linux ag 资源未通过pacemaker 进行故障转移