当不形成与MGMTPOSTGRESS_MASTER时的一集群本文描述如何恢复MGMTPOSTGRES_SLAVE。
Cisco 建议您了解以下主题:
- Linux接口
- 虚拟机环境
- postgresql
- 心脏起搏器/Corosync配置系统(PC)
使用的组件
本文档中的信息基于以下软件版本:
- CloudCenter版本4.8.1.1
- MGMTPOSTGRES_SLAVE组件
- MGMTPOSTGRES_MASTER组件
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络实际,请保证您了解所有命令潜在影响。
背景信息
如果有两个MGMTPOSTGRES组件的一失败, MGMTPOSTGRES_SLAVE不再形成与MGMTPOSTGRES_MASTER的一集群。
MGMTPOSTGRES_SLAVE不形成与MGMTPOSTGRES_MASTER的一集群。为了获得两个MGMTPOSTGRES形成集群, MGMTPOSTGRES_SLAVE数据库需要删除。然后,数据库从MGMTPOSTGRES_MASTER将恢复。
错误日志
[root@mgmtpostgres_master etc]# pcs status
Cluster name: cliqrdbcluster
Stack: corosync
Current DC: dbmaster (version 1.1.15-11.e174ec8) – partition with quorum
Last updated: Mon Nov 13 19:15:30 2017 Last changed: Mon Nov 13 16:59:51 2017 by root via crm_attribute on db master
2 nodes and 3 resources configured
Online: [ dbmaster dbslave ]
Full list of resrouces:
Resrouce Group: VIPGroup
PGMasterVIP (ocf::heartbeat:IPaddr2): Started dbmaster
Master/Slave Set: mspostgresql [pgsql]
Masters: [ dbmaster ]
Stopped: [ dbslave ]
Failed Actions:
* pgsql_start_0 on dbslave ‘unknown error’ (1): call=11, status=Timed Out, exitreason=’none’,
last-rc-change=’Mon Nov 13 18:15:25 2017’, queued-0ms, exec=60003ms
Daemon Status:
corosyn: active/disabled
pacemaker: active/enabled
pcsd: inactive/disabled
继续恢复MGMTPOSTGRES_SLAVE数据库为了MGMTPOSTGRES能形成集群。
步骤1:在MGMTPOSTGRES_MASTER中,请保证集群被终止。
pcs cluster stop
pcs status
第二步:在MGMTPOSTGRES_SLAVE中,请删除现有的数据库。
rm -rf /var/lib/pgsql/9.5/data/*
第三步:在MGMTPOSTGRES_MASTER中,再请开始集群。
pcs cluster start
pcs status
第四步:在MGMTPOSTGRES_SLAVE中,从MGMTPOSTGRES_MASTER请恢复数据库。
/usr/pgsql-9.5/bin/pg_basebackup -h <MGMTPOSTGRES_MASTER-IP> -D /var/lib/pgsql/9.5/data/ -U replication -v -P --xlog-method=stream
第五步:在MGMTPOSTGRES_SLAVE中,请改变恢复的数据库的所有权。
chown postgres:postgres -R /var/lib/pgsql/9.5/data/*
第六步:在MGMTPOSTGRES_SLAVE中,请开始集群。
pcs cluster start
pcs cluster status
步骤 7.在MGMTPOSTGRES_MASTER中,请整理资源并且检查集群状态。
pcs resource cleanup
pcs cluster status
步骤 8在MGMTPOSTGRES_MASTER中,请验证有复制(请寻找在MGMTPOSTGRES_SLAVE IP的IP)。
ps –ef | grep postgr