节点从集群中移除的状态
show status like '%wsrep%';
wsrep_cluster_status为Disconnected则表示该节点已经不在集群中了,示例如下
> show status like '%wsrep%'; +--------------------------+----------------------+ | Variable_name | Value | +--------------------------+----------------------+ | wsrep_cluster_conf_id | 18446744073709551615 | | wsrep_cluster_size | 0 | | wsrep_cluster_state_uuid | | | wsrep_cluster_status | Disconnected | | wsrep_connected | OFF | | wsrep_local_bf_aborts | 0 | | wsrep_local_index | 18446744073709551615 | | wsrep_provider_name | | | wsrep_provider_vendor | | | wsrep_provider_version | | | wsrep_ready | ON | +--------------------------+----------------------+ 11 rows in set (0.00 sec)
正常的集群节点状态
>show status like '%wsrep%'; +----------------------------------+-----------------------------------------------------+ | Variable_name | Value | +----------------------------------+-----------------------------------------------------+ | wsrep_local_state_uuid | 5a290219-fcfc-11e8-b8b9-13c62e5c16f1 | | wsrep_protocol_version | 8 | | wsrep_last_applied | 6611991575 | | wsrep_last_committed | 6611991589 | | wsrep_replicated | 524590452 | | wsrep_replicated_bytes | 1094596990048 | | wsrep_repl_keys | 5967904705 | | wsrep_repl_keys_bytes | 60340440512 | | wsrep_repl_data_bytes | 998666384164 | | wsrep_repl_other_bytes | 0 | | wsrep_received | 3695397 | | wsrep_received_bytes | 29564596 | | wsrep_local_commits | 524590438 | | wsrep_local_cert_failures | 0 | | wsrep_local_replays | 0 | | wsrep_local_send_queue | 0 | | wsrep_local_send_queue_max | 66 | | wsrep_local_send_queue_min | 0 | | wsrep_local_send_queue_avg | 2.321160 | | wsrep_local_recv_queue | 0 | | wsrep_local_recv_queue_max | 3 | | wsrep_local_recv_queue_min | 0 | | wsrep_local_recv_queue_avg | 0.000160 | | wsrep_local_cached_downto | 6605892261 | | wsrep_flow_control_paused_ns | 173078420690665 | | wsrep_flow_control_paused | 0.164600 | | wsrep_flow_control_sent | 0 | | wsrep_flow_control_recv | 2806150 | | wsrep_flow_control_interval | [ 141, 141 ] | | wsrep_flow_control_interval_low | 141 | | wsrep_flow_control_interval_high | 141 | | wsrep_flow_control_status | OFF | | wsrep_cert_deps_distance | 418.873157 | | wsrep_apply_oooe | 0.723585 | | wsrep_apply_oool | 0.047621 | | wsrep_apply_window | 3.941686 | | wsrep_commit_oooe | 0.000000 | | wsrep_commit_oool | 0.000000 | | wsrep_commit_window | 1.047392 | | wsrep_local_state | 4 | | wsrep_local_state_comment | Synced | | wsrep_cert_index_size | 468 | | wsrep_cert_bucket_count | 520252 | | wsrep_gcache_pool_size | 4294968600 | | wsrep_causal_reads | 0 | | wsrep_cert_interval | 9.885857 | | wsrep_ist_receive_status | | | wsrep_ist_receive_seqno_start | 0 | | wsrep_ist_receive_seqno_current | 0 | | wsrep_ist_receive_seqno_end | 0 | | wsrep_incoming_addresses | 10.*.*.*:3306,10.*.*.*:3306 | | wsrep_desync_count | 0 | | wsrep_evs_delayed | | | wsrep_evs_evict_list | | | wsrep_evs_repl_latency | 0.000125601/0.000556424/0.00157762/0.000167964/6997 | | wsrep_evs_state | OPERATIONAL | | wsrep_gcomm_uuid | e52417ca-fcf6-11e8-ad11-12b1aba37990 | | wsrep_cluster_conf_id | 4 | | wsrep_cluster_size | 2 | | wsrep_cluster_state_uuid | 5a290219-fcfc-11e8-b8b9-13c62e5c16f1 | | wsrep_cluster_status | Primary | | wsrep_connected | ON | | wsrep_local_bf_aborts | 0 | | wsrep_local_index | 1 | | wsrep_provider_name | Galera | | wsrep_provider_vendor | Codership Oy <info@codership.com> | | wsrep_provider_version | 3.26(rac090bc) | | wsrep_ready | ON | +----------------------------------+-----------------------------------------------------+ 68 rows in set (0.04 sec)
主要参数说明
该集群原来是三个节点,一个节点从集群移出之后,wsrep_incoming_addresses 显示为了两个节点;
wsrep_cluster_status 在所在正常的节点中都显示为Primary ,显示为其他值时表示节点有异常
wsrep_flow_control_paused表示复制停止了多少秒
监控状态说明
集群完整性检查:
wsrep_cluster_state_uuid:在集群所有节点的值应该是相同的,有不同值的节点,说明其没有连接入集群.
wsrep_cluster_conf_id:正常情况下所有节点上该值是一样的.如果值不同,说明该节点被临时”分区”了.当节点之间网络连接恢复 的时候应该会恢复一样的值.
wsrep_cluster_size:如果这个值跟预期的节点数一致,则所有的集群节点已经连接.
wsrep_cluster_status:集群组成的状态.如果不为”Primary”,说明出现”分区”或是”split-brain”脑裂状况.
节点状态检查:
wsrep_ready: 该值为 ON,则说明可以接受 SQL 负载.如果为 Off,则需要检查 wsrep_connected.
wsrep_connected: 如果该值为 Off,且 wsrep_ready 的值也为 Off,则说明该节点没有连接到集群.(可能是 wsrep_cluster_address 或 wsrep_cluster_name 等配置错造成的.具体错误需要查看错误日志)
wsrep_local_state_comment:如果 wsrep_connected 为 On,但 wsrep_ready 为 OFF,则可以从该项查看原因.
复制健康检查:
wsrep_flow_control_paused:表示复制停止了多长时间.即表明集群因为 Slave 延迟而慢的程度.值为 0~1,越靠近 0 越好,值为 1 表示 复制完全停止.可优化 wsrep_slave_threads 的值来改善.
wsrep_cert_deps_distance:有多少事务可以并行应用处理.wsrep_slave_threads 设置的值不应该高出该值太多.
wsrep_flow_control_sent:表示该节点已经停止复制了多少次.
wsrep_local_recv_queue_avg:表示 slave 事务队列的平均长度.slave 瓶颈的预兆.
最慢的节点的 wsrep_flow_control_sent 和 wsrep_local_recv_queue_avg 这两个值最高.这两个值较低的话,相对更好.
检测慢网络问题:
wsrep_local_send_queue_avg:网络瓶颈的预兆.如果这个值比较高的话,可能存在网络瓶
冲突或死锁的数目:
wsrep_last_committed:最后提交的事务数目
wsrep_local_cert_failures 和 wsrep_local_bf_aborts:回滚,检测到的冲突数目