节点规划

    ansible
    node1 数据库主节点
    node2 从1
    node3 从2

    数据库主节点:

    1. [root@node1 ~]# netstat -nulpt
    2. Active Internet connections (only servers)
    3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    4. tcp 0 0 192.168.200.12:3306 0.0.0.0:* LISTEN 10488/mysqld
    5. tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 547/rpcbind
    6. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1171/sshd
    7. tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10488/mysqld
    8. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 976/master
    9. tcp6 0 0 :::111 :::* LISTEN 547/rpcbind
    10. tcp6 0 0 :::22 :::* LISTEN 1171/sshd
    11. tcp6 0 0 ::1:25 :::* LISTEN 976/master
    12. udp 0 0 127.0.0.1:323 0.0.0.0:* 519/chronyd
    13. udp 0 0 0.0.0.0:709 0.0.0.0:* 547/rpcbind
    14. udp 0 0 0.0.0.0:68 0.0.0.0:* 801/dhclient
    15. udp 0 0 0.0.0.0:111 0.0.0.0:* 547/rpcbind
    16. udp6 0 0 ::1:323 :::* 519/chronyd
    17. udp6 0 0 :::709 :::* 547/rpcbind
    18. udp6 0 0 :::111 :::* 547/rpcbind

    从节点1:

    1. [root@node2 ~]# netstat -nulpt
    2. Active Internet connections (only servers)
    3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    4. tcp 0 0 192.168.200.9:3306 0.0.0.0:* LISTEN 10428/mysqld
    5. tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 525/rpcbind
    6. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1171/sshd
    7. tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10428/mysqld
    8. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 976/master
    9. tcp6 0 0 :::111 :::* LISTEN 525/rpcbind
    10. tcp6 0 0 :::22 :::* LISTEN 1171/sshd
    11. tcp6 0 0 ::1:25 :::* LISTEN 976/master
    12. udp 0 0 127.0.0.1:323 0.0.0.0:* 524/chronyd
    13. udp 0 0 0.0.0.0:687 0.0.0.0:* 525/rpcbind
    14. udp 0 0 0.0.0.0:68 0.0.0.0:* 800/dhclient
    15. udp 0 0 0.0.0.0:111 0.0.0.0:* 525/rpcbind
    16. udp6 0 0 ::1:323 :::* 524/chronyd
    17. udp6 0 0 :::687 :::* 525/rpcbind
    18. udp6 0 0 :::111 :::* 525/rpcbind

    从节点2

    1. [root@node3 ~]# netstat -nulpt
    2. Active Internet connections (only servers)
    3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    4. tcp 0 0 192.168.200.16:3306 0.0.0.0:* LISTEN 10428/mysqld
    5. tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 542/rpcbind
    6. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1173/sshd
    7. tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 10428/mysqld
    8. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 977/master
    9. tcp6 0 0 :::111 :::* LISTEN 542/rpcbind
    10. tcp6 0 0 :::22 :::* LISTEN 1173/sshd
    11. tcp6 0 0 ::1:25 :::* LISTEN 977/master
    12. udp 0 0 127.0.0.1:323 0.0.0.0:* 522/chronyd
    13. udp 0 0 0.0.0.0:712 0.0.0.0:* 542/rpcbind
    14. udp 0 0 0.0.0.0:68 0.0.0.0:* 801/dhclient
    15. udp 0 0 0.0.0.0:111 0.0.0.0:* 542/rpcbind
    16. udp6 0 0 ::1:323 :::* 522/chronyd
    17. udp6 0 0 :::712 :::* 542/rpcbind
    18. udp6 0 0 :::111 :::* 542/rpcbind

    数据库主节点详细信息:

    1. MariaDB [(none)]> show status like 'wsrep%';
    2. +-------------------------------+------------------------------------------------------------+
    3. | Variable_name | Value |
    4. +-------------------------------+------------------------------------------------------------+
    5. | wsrep_applier_thread_count | 1 |
    6. | wsrep_apply_oooe | 0.000000 |
    7. | wsrep_apply_oool | 0.000000 |
    8. | wsrep_apply_window | 0.000000 |
    9. | wsrep_causal_reads | 1 |
    10. | wsrep_cert_deps_distance | 0.000000 |
    11. | wsrep_cert_index_size | 0 |
    12. | wsrep_cert_interval | 0.000000 |
    13. | wsrep_cluster_conf_id | 3 |
    14. | wsrep_cluster_size | 3 |
    15. | wsrep_cluster_state_uuid | 8296c95e-5a85-11ec-b63e-326586fd932e |
    16. | wsrep_cluster_status | Primary |
    17. | wsrep_cluster_weight | 3 |
    18. | wsrep_commit_oooe | 0.000000 |
    19. | wsrep_commit_oool | 0.000000 |
    20. | wsrep_commit_window | 0.000000 |
    21. | wsrep_connected | ON |
    22. | wsrep_desync_count | 0 |
    23. | wsrep_evs_delayed | |
    24. | wsrep_evs_evict_list | |
    25. | wsrep_evs_repl_latency | 0/0/0/0/0 |
    26. | wsrep_evs_state | OPERATIONAL |
    27. | wsrep_flow_control_paused | 0.000000 |
    28. | wsrep_flow_control_paused_ns | 0 |
    29. | wsrep_flow_control_recv | 0 |
    30. | wsrep_flow_control_sent | 0 |
    31. | wsrep_gcomm_uuid | 82910d3c-5a85-11ec-a891-5b9beede3ad8 |
    32. | wsrep_incoming_addresses | 192.168.200.12:3306,192.168.200.9:3306,192.168.200.16:3306 |
    33. | wsrep_last_committed | 0 |
    34. | wsrep_local_bf_aborts | 0 |
    35. | wsrep_local_cached_downto | 18446744073709551615 |
    36. | wsrep_local_cert_failures | 0 |
    37. | wsrep_local_commits | 0 |
    38. | wsrep_local_index | 0 |
    39. | wsrep_local_recv_queue | 0 |
    40. | wsrep_local_recv_queue_avg | 0.100000 |
    41. | wsrep_local_recv_queue_max | 2 |
    42. | wsrep_local_recv_queue_min | 0 |
    43. | wsrep_local_replays | 0 |
    44. | wsrep_local_send_queue | 0 |
    45. | wsrep_local_send_queue_avg | 0.500000 |
    46. | wsrep_local_send_queue_max | 2 |
    47. | wsrep_local_send_queue_min | 0 |
    48. | wsrep_local_state | 4 |
    49. | wsrep_local_state_comment | Synced |
    50. | wsrep_local_state_uuid | 8296c95e-5a85-11ec-b63e-326586fd932e |
    51. | wsrep_open_connections | 0 |
    52. | wsrep_open_transactions | 0 |
    53. | wsrep_protocol_version | 9 |
    54. | wsrep_provider_name | Galera |
    55. | wsrep_provider_vendor | Codership Oy <info@codership.com> |
    56. | wsrep_provider_version | 25.3.29(r3902) |
    57. | wsrep_ready | ON |
    58. | wsrep_received | 10 |
    59. | wsrep_received_bytes | 755 |
    60. | wsrep_repl_data_bytes | 0 |
    61. | wsrep_repl_keys | 0 |
    62. | wsrep_repl_keys_bytes | 0 |
    63. | wsrep_repl_other_bytes | 0 |
    64. | wsrep_replicated | 0 |
    65. | wsrep_replicated_bytes | 0 |
    66. | wsrep_rollbacker_thread_count | 1 |
    67. | wsrep_thread_count | 2 |
    68. +-------------------------------+------------------------------------------------------------+
    69. 63 rows in set (0.002 sec)

    QQ截图20211209172420.png