6. 验证集群状态:
在 node1 上执行:
[root@node1 ~]# mysql -uroot -p ## 进入数据库
查看是否启用 galera 插件
连接 mariadb, 查看是否启用 galera 插件
- MariaDB [(none)]> show status like "wsrep_ready";
- +---------------+-------+
- | Variable_name | Value |
- +---------------+-------+
- | wsrep_ready | ON |
- +---------------+-------+
- 1 row in set (0.004 sec)
目前集群机器数
- MariaDB [(none)]> show status like "wsrep_cluster_size";
- +--------------------+-------+
- | Variable_name | Value |
- +--------------------+-------+
- | wsrep_cluster_size | 3 |
- +--------------------+-------+
- 1 row in set (0.001 sec)
查看集群状态
- MariaDB [(none)]> show status like "wsrep%";
- +------------------------------+----------------------------------------------------------------+
- | Variable_name | Value |
- +------------------------------+----------------------------------------------------------------+
- | wsrep_apply_oooe | 0.000000 |
- | wsrep_apply_oool | 0.000000 |
- | wsrep_apply_window | 1.000000 |
- | wsrep_causal_reads | 14 |
- | wsrep_cert_deps_distance | 1.200000 |
- | wsrep_cert_index_size | 3 |
- | wsrep_cert_interval | 0.000000 |
- | wsrep_cluster_conf_id | 22 |
- | wsrep_cluster_size | 3 | ## 集群成员
- | wsrep_cluster_state_uuid | b8ecf355-233a-11e8-825e-bb38179b0eb4 | ##UUID 集群唯一标记
- | wsrep_cluster_status | Primary | ## 主服务器
- | wsrep_commit_oooe | 0.000000 |
- | wsrep_commit_oool | 0.000000 |
- | wsrep_commit_window | 1.000000 |
- | wsrep_connected | ON | ## 当前是否连接中
- | wsrep_desync_count | 0 |
- | wsrep_evs_delayed | |
- | wsrep_evs_evict_list | |
- | wsrep_evs_repl_latency | 0/0/0/0/0 |
- | wsrep_evs_state | OPERATIONAL |
- | wsrep_flow_control_paused | 0.000000 |
- | wsrep_flow_control_paused_ns | 0 |
- | wsrep_flow_control_recv | 0 |
- | wsrep_flow_control_sent | 0 |
- | wsrep_gcomm_uuid | 0eba3aff-2341-11e8-b45a-f277db2349d5 |
- | wsrep_incoming_addresses | 192.168.153.142:3306,192.168.153.143:3306,192.168.153.144:3306 | ## 连接中的数据库
- | wsrep_last_committed | 9 | ##sql 提交记录
- | wsrep_local_bf_aborts | 0 | ## 从执行事务过程被本地中断
- | wsrep_local_cached_downto | 5 |
- | wsrep_local_cert_failures | 0 | ## 本地失败事务
- | wsrep_local_commits | 4 | ## 本地执行的 sql
- | wsrep_local_index | 0 |
- | wsrep_local_recv_queue | 0 |
- | wsrep_local_recv_queue_avg | 0.057143 |
- | wsrep_local_recv_queue_max | 2 |
- | wsrep_local_recv_queue_min | 0 |
- | wsrep_local_replays | 0 |
- | wsrep_local_send_queue | 0 | ## 本地发出的队列
- | wsrep_local_send_queue_avg | 0.000000 | ## 队列平均时间间隔
- | wsrep_local_send_queue_max | 1 |
- | wsrep_local_send_queue_min | 0 |
- | wsrep_local_state | 4 |
- | wsrep_local_state_comment | Synced |
- | wsrep_local_state_uuid | b8ecf355-233a-11e8-825e-bb38179b0eb4 | ## 集群 ID
- | wsrep_protocol_version | 8 |
- | wsrep_provider_name | Galera |
- | wsrep_provider_vendor | Codership Oy <info@codership.com> |
- | wsrep_provider_version | 25.3.23(r3789) |
- | wsrep_ready | ON | ## 插件是否应用中
- | wsrep_received | 35 | ## 数据复制接收次数
- | wsrep_received_bytes | 5050 |
- | wsrep_repl_data_bytes | 1022 |
- | wsrep_repl_keys | 14 |
- | wsrep_repl_keys_bytes | 232 |
- | wsrep_repl_other_bytes | 0 |
- | wsrep_replicated | 5 | ## 随着复制发出的次数
- | wsrep_replicated_bytes | 1600 | ## 数据复制发出的字节数
- | wsrep_thread_count | 2 |
- +------------------------------+----------------------------------------------------------------+
- 58 rows in set (0.003 sec)
查看连接的主机
- MariaDB [(none)]> show status like "wsrep_incoming_addresses";
- +--------------------------+----------------------------------------------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------------------------------------------+
- | wsrep_incoming_addresses | 192.168.153.142:3306,192.168.153.143:3306,192.168.153.144:3306 |
- +--------------------------+----------------------------------------------------------------+
- 1 row in set (0.002 sec)
来源: http://www.linuxidc.com/Linux/2018-03/151302.htm