ITPub博客

首页 > 数据库 > 国内数据库 > LightDB 数据库高可用模式主备集群状态-专栏

LightDB 数据库高可用模式主备集群状态-专栏

原创 国内数据库 作者:yjspace 时间:2022-09-27 11:47:23 0 删除 编辑

正常运行状态

  在主节点或从节点运行命令  ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status 展示的信息中没有 WARNING; Status和 Upstream字段没有出现 ?和 !符号

$ ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status
 ID | Name                          | Role    | Status    | Upstream                      | ltclusterd | PID   | Paused? | Upstream last seen
----+-------------------------------+---------+-----------+-------------------------------+------------+-------+---------+--------------------
 1  | lightdbCluster102014812210001 | primary | * running |                               | running    | 13257 | no      | n/a                
 2  | lightdbCluster102014812610001 | standby |   running | lightdbCluster102014812210001 | running    | 29747 | no      | 0 second(s) ago


在各个节点运行命令 ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf node check展示的各个检查项的均为 OK。

示例结果:

$ ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf node check
Node "lightdbCluster102014812210001":
	Server role: OK (node is primary)
	Replication lag: OK (N/A - node is primary)
	WAL archiving: OK (0 pending archive ready files)
	Upstream connection: OK (N/A - node is primary)
	Downstream servers: OK (1 of 1 downstream nodes attached)
	Replication slots: OK (1 of 1 physical replication slots are active)
	Missing physical replication slots: OK (node has no missing physical replication slots)
	Configured data directory: OK (configured "data_directory" is "/data2/lightdb/lightdb-test/data")


异常状态一:主备不同步

在主节点或从节点运行命令  ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status  展示的信息有 WARNING: node "lightdbCluster102014812610001" (ID: 2) is running but the ltcluster node record is inactive ;  standby 的running出现 ! 符号。表示,主备状态不同步 :

$ ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status
 ID | Name                          | Role    | Status    | Upstream                      | ltclusterd | PID   | Paused? | Upstream last seen
----+-------------------------------+---------+-----------+-------------------------------+------------+-------+---------+--------------------
 1  | lightdbCluster102014812210001 | primary | * running |                               | running    | 13257 | no      | n/a                
 2  | lightdbCluster102014812610001 | standby | ! running | lightdbCluster102014812210001 | running    | 29747 | no      | n/a                
WARNING: following issues were detected
  - node "lightdbCluster102014812610001" (ID: 2) is running but the ltcluster node record is inactive

原因分析:网络延迟过高,同步起来比较慢

解决方案:1. 建议部署时检查网络延迟;2. 备节点可能重新一段时间的失联,如果网络没有问题,可等待主节点同步完。


异常状态二:复制槽丢失

在主节点或从节点运行命令  ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status  展示的信息有 WARNING:

node "lightdbCluster102014812610001" (ID: 2) is not attached to its upstream node "lightdbCluster102014812210001" (ID: 1) ;  standbyd的上游节点找不到 lightdbCluster102014812210001 出现 ! 符号。表示主节点无法同步到备节点 ,链接不到复制槽:

$ ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf service status
WARNING: node "lightdbCluster102014812610001" not found in "pg_stat_replication"
 ID | Name                          | Role    | Status    | Upstream                        | ltclusterd | PID   | Paused? | Upstream last seen
----+-------------------------------+---------+-----------+---------------------------------+------------+-------+---------+--------------------
 1  | lightdbCluster102014812210001 | primary | * running |                                 | running    | 13257 | no      | n/a                
 2  | lightdbCluster102014812610001 | standby |   running | ! lightdbCluster102014812210001 | running    | 8988  | no      | 0 second(s) ago    
WARNING: following issues were detected
  - node "lightdbCluster102014812610001" (ID: 2) is not attached to its upstream node "lightdbCluster102014812210001" (ID: 1)


在各个节点运行命令 ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf node check 展示的各个检查项,提示找不到逻辑复制槽

$ ltcluster -f $LTHOME/etc/ltcluster/ltcluster.conf node check
WARNING: node "lightdbCluster102014812610001" not found in "pg_stat_replication"
Node "lightdbCluster102014812210001":
        Server role: OK (node is primary)
        Replication lag: OK (N/A - node is primary)
        WAL archiving: OK (0 pending archive ready files)
        Upstream connection: OK (N/A - node is primary)
        Downstream servers: CRITICAL (1 of 1 downstream nodes not attached; missing: lightdbCluster102014812610001 (ID: 2))
        Replication slots: OK (node has no physical replication slots)
        Missing physical replication slots: CRITICAL (1 physical replication slots are missing: ltcluster_slot_2)
        Configured data directory: OK (configured "data_directory" is "/data2/lightdb/lightdb-test/data")


查看同步表  select * from pg_stat_replication; 是否有同步记录,如果没有则不能同步


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70018364/viewspace-2916356/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: LightDB订阅和发布
请登录后发表评论 登录
全部评论

注册时间:2022-05-29

  • 博文量
    7
  • 访问量
    3367