节点规划
| ansible | ||
|---|---|---|
| node1 | 数据库主节点 | |
| node2 | 从1 | |
| node3 | 从2 |
数据库主节点:
[root@node1 ~]# netstat -nulptActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 192.168.200.12:3306 0.0.0.0:* LISTEN 10488/mysqldtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 547/rpcbindtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1171/sshdtcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10488/mysqldtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 976/mastertcp6 0 0 :::111 :::* LISTEN 547/rpcbindtcp6 0 0 :::22 :::* LISTEN 1171/sshdtcp6 0 0 ::1:25 :::* LISTEN 976/masterudp 0 0 127.0.0.1:323 0.0.0.0:* 519/chronydudp 0 0 0.0.0.0:709 0.0.0.0:* 547/rpcbindudp 0 0 0.0.0.0:68 0.0.0.0:* 801/dhclientudp 0 0 0.0.0.0:111 0.0.0.0:* 547/rpcbindudp6 0 0 ::1:323 :::* 519/chronydudp6 0 0 :::709 :::* 547/rpcbindudp6 0 0 :::111 :::* 547/rpcbind
从节点1:
[root@node2 ~]# netstat -nulptActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 192.168.200.9:3306 0.0.0.0:* LISTEN 10428/mysqldtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 525/rpcbindtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1171/sshdtcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10428/mysqldtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 976/mastertcp6 0 0 :::111 :::* LISTEN 525/rpcbindtcp6 0 0 :::22 :::* LISTEN 1171/sshdtcp6 0 0 ::1:25 :::* LISTEN 976/masterudp 0 0 127.0.0.1:323 0.0.0.0:* 524/chronydudp 0 0 0.0.0.0:687 0.0.0.0:* 525/rpcbindudp 0 0 0.0.0.0:68 0.0.0.0:* 800/dhclientudp 0 0 0.0.0.0:111 0.0.0.0:* 525/rpcbindudp6 0 0 ::1:323 :::* 524/chronydudp6 0 0 :::687 :::* 525/rpcbindudp6 0 0 :::111 :::* 525/rpcbind
从节点2
[root@node3 ~]# netstat -nulptActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 192.168.200.16:3306 0.0.0.0:* LISTEN 10428/mysqldtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 542/rpcbindtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1173/sshdtcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10428/mysqldtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 977/mastertcp6 0 0 :::111 :::* LISTEN 542/rpcbindtcp6 0 0 :::22 :::* LISTEN 1173/sshdtcp6 0 0 ::1:25 :::* LISTEN 977/masterudp 0 0 127.0.0.1:323 0.0.0.0:* 522/chronydudp 0 0 0.0.0.0:712 0.0.0.0:* 542/rpcbindudp 0 0 0.0.0.0:68 0.0.0.0:* 801/dhclientudp 0 0 0.0.0.0:111 0.0.0.0:* 542/rpcbindudp6 0 0 ::1:323 :::* 522/chronydudp6 0 0 :::712 :::* 542/rpcbindudp6 0 0 :::111 :::* 542/rpcbind
数据库主节点详细信息:
MariaDB [(none)]> show status like 'wsrep%';+-------------------------------+------------------------------------------------------------+| Variable_name | Value |+-------------------------------+------------------------------------------------------------+| wsrep_applier_thread_count | 1 || wsrep_apply_oooe | 0.000000 || wsrep_apply_oool | 0.000000 || wsrep_apply_window | 0.000000 || wsrep_causal_reads | 1 || wsrep_cert_deps_distance | 0.000000 || wsrep_cert_index_size | 0 || wsrep_cert_interval | 0.000000 || wsrep_cluster_conf_id | 3 || wsrep_cluster_size | 3 || wsrep_cluster_state_uuid | 8296c95e-5a85-11ec-b63e-326586fd932e || wsrep_cluster_status | Primary || wsrep_cluster_weight | 3 || wsrep_commit_oooe | 0.000000 || wsrep_commit_oool | 0.000000 || wsrep_commit_window | 0.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 | 82910d3c-5a85-11ec-a891-5b9beede3ad8 || wsrep_incoming_addresses | 192.168.200.12:3306,192.168.200.9:3306,192.168.200.16:3306 || wsrep_last_committed | 0 || wsrep_local_bf_aborts | 0 || wsrep_local_cached_downto | 18446744073709551615 || wsrep_local_cert_failures | 0 || wsrep_local_commits | 0 || wsrep_local_index | 0 || wsrep_local_recv_queue | 0 || wsrep_local_recv_queue_avg | 0.100000 || 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.500000 || wsrep_local_send_queue_max | 2 || wsrep_local_send_queue_min | 0 || wsrep_local_state | 4 || wsrep_local_state_comment | Synced || wsrep_local_state_uuid | 8296c95e-5a85-11ec-b63e-326586fd932e || wsrep_open_connections | 0 || wsrep_open_transactions | 0 || wsrep_protocol_version | 9 || wsrep_provider_name | Galera || wsrep_provider_vendor | Codership Oy <info@codership.com> || wsrep_provider_version | 25.3.29(r3902) || wsrep_ready | ON || wsrep_received | 10 || wsrep_received_bytes | 755 || wsrep_repl_data_bytes | 0 || wsrep_repl_keys | 0 || wsrep_repl_keys_bytes | 0 || wsrep_repl_other_bytes | 0 || wsrep_replicated | 0 || wsrep_replicated_bytes | 0 || wsrep_rollbacker_thread_count | 1 || wsrep_thread_count | 2 |+-------------------------------+------------------------------------------------------------+63 rows in set (0.002 sec)

