参考一主两备安装过程,cluster_config.xml配置文件多一行内容即可。
https://www.modb.pro/db/507970
<DEVICE sn="omm3">
<!-- 节点3的主机名称 -->
<PARAM name="name" value="ccf12"/>
<!-- 节点3所在的AZ及AZ优先级 -->
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.6.203"/>
<PARAM name="sshIp1" value="192.168.6.203"/>
<PARAM name="cascadeRole" value="on"/> #增加此一行内容
...
检查主从
[omm@ccf11 ~]$ gs_om -t status --detail
[ CMServer State ]
node node_ip instance state
-------------------------------------------------------------------------
1 ccf10 192.168.6.201 1 /opt/openGauss/install/cm/cm_server Primary
2 ccf11 192.168.6.202 2 /opt/openGauss/install/cm/cm_server Standby
3 ccf12 192.168.6.203 3 /opt/openGauss/install/cm/cm_server Standby
[ Cluster State ]
cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL
[ Datanode State ]
node node_ip instance state
---------------------------------------------------------------
1 ccf10 192.168.6.201 6001 /data/openGauss P Primary Normal
2 ccf11 192.168.6.202 6002 /data/openGauss S Standby Normal
3 ccf12 192.168.6.203 6003 /data/openGauss C Cascade Standby Normal
集群状态查询及启停
(1)状态查询
[omm@ccf10 ~]$ cm_ctl query -Cv
[ CMServer State ]
node instance state
-------------------------
1 ccf10 1 Primary
2 ccf11 2 Standby
3 ccf12 3 Standby
[ Cluster State ]
cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL
[ Datanode State ]
node instance state | node instance state | node instance state
---------------------------------------------------------------------------------------------------------------
1 ccf10 6001 P Primary Normal | 2 ccf11 6002 S Standby Normal | 3 ccf12 6003 C Cascade Standby Normal
[omm@ccf10 ~]$
注:测试主备宕机集群异常,集群状态为Unavailable,此时数据库存在Need repair节点。
级联备库宕机,集群状态为Degraded,主备同步正常,但存在故障的数据库节点。
最好还是不要使用级联备库,出现故障时处理麻烦。