MariaDB 11.8 : MariaDB Galera Cluster2025/11/24 |
|
MariaDB Galera Cluster の設定です。 |
|
| [1] | 設定するノード全てで Galera 用のパッケージをインストールします。 |
|
www:~ #
zypper -n install mariadb-galera # Firewalld 有効の場合は以下を設定 www:~ # firewall-cmd --add-service=mysql www:~ # firewall-cmd --add-port={3306/tcp,4567/tcp,4568/tcp,4444/tcp} www:~ # firewall-cmd --runtime-to-permanent |
| [2] | 1 台目のノードを設定します。 |
|
www:~ #
vi /etc/my.cnf.d/50-galera.cnf # 43行目 : 任意のクラスター名を指定 wsrep_cluster_name=" Galera_Cluster "
# 46行目 : コメント解除して以下のように変更 wsrep_cluster_address=" gcomm:// "
# 54行目 : コメント解除して自身の IP アドレスに変更 wsrep_node_address= "10.0.0.31"
www:~ #
vi /etc/my.cnf.d/50-galera.cnf # 46行目 : クラスター参加ホストをカンマ区切りで追記しておく wsrep_cluster_address="gcomm:// 10.0.0.31,10.0.0.51 "
# 初期設定を実施 www:~ # mariadb-secure-installation |
| [3] | 2 台目以降のノードを設定します。 |
|
node01:~ #
vi /etc/my.cnf.d/50-galera.cnf # 43行目 : 1台目のノードで指定したクラスター名 wsrep_cluster_name=" Galera_Cluster "
# 46行目 : コメント解除してクラスター参加ホストをカンマ区切りで指定 wsrep_cluster_address=" gcomm://10.0.0.31,10.0.0.51 "
# 54行目 : コメント解除して自身の IP アドレスに変更 wsrep_node_address= "10.0.0.51"
setsebool -P nis_enabled 1 node01:~ # systemctl enable --now mariadb |
| [4] | 以上で設定完了です。以下のようにステータスを確認し、[wsrep_local_state_comment] が [Synced] になっていれば OK です。 後は、クラスタ参加の各ノードからテストデータを挿入して正常に同期されるか確認してください。 |
|
node01:~ # mariadb Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 11.8.3-MariaDB-log MariaDB package Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> show status like 'wsrep_%'; +-------------------------------+----------------------------------------------------------------+ | Variable_name | Value | +-------------------------------+----------------------------------------------------------------+ | wsrep_local_state_uuid | dd4d4b72-c8d6-11f0-9edc-0b56129ef20f | | wsrep_protocol_version | 11 | | wsrep_protocol_application | 4 | | wsrep_protocol_replicator | 11 | | wsrep_protocol_gcs | 5 | | wsrep_last_committed | 44 | | wsrep_replicated | 0 | | wsrep_replicated_bytes | 0 | | wsrep_repl_keys | 0 | | wsrep_repl_keys_bytes | 0 | | wsrep_repl_data_bytes | 0 | | wsrep_repl_other_bytes | 0 | | wsrep_received | 3 | | wsrep_received_bytes | 232 | | wsrep_local_commits | 0 | | wsrep_local_cert_failures | 0 | | wsrep_local_replays | 0 | | wsrep_local_send_queue | 0 | | wsrep_local_send_queue_max | 2 | | wsrep_local_send_queue_min | 0 | | wsrep_local_send_queue_avg | 0.333333 | | wsrep_local_recv_queue | 0 | | wsrep_local_recv_queue_max | 1 | | wsrep_local_recv_queue_min | 0 | | wsrep_local_recv_queue_avg | 0 | | wsrep_local_cached_downto | 2 | | wsrep_flow_control_paused_ns | 0 | | wsrep_flow_control_paused | 0 | | wsrep_flow_control_sent | 0 | | wsrep_flow_control_recv | 0 | | wsrep_flow_control_active | false | | wsrep_flow_control_requested | false | | wsrep_cert_deps_distance | 1 | | wsrep_apply_oooe | 0 | | wsrep_apply_oool | 0 | | wsrep_apply_window | 1 | | wsrep_apply_waits | 0 | | wsrep_commit_oooe | 0 | | wsrep_commit_oool | 0 | | wsrep_commit_window | 1 | | wsrep_local_state | 4 | | wsrep_local_state_comment | Synced | | wsrep_cert_index_size | 3 | | wsrep_causal_reads | 0 | | wsrep_cert_interval | 2.5 | | wsrep_open_transactions | 0 | | wsrep_open_connections | 0 | | wsrep_incoming_addresses | 10.0.0.31:0,10.0.0.51:0 | | wsrep_cluster_weight | 2 | | 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_gcomm_uuid | 2ae760f4-c8d8-11f0-81ae-4a84f21daa29 | | wsrep_gmcast_segment | 0 | | wsrep_applier_thread_count | 1 | | wsrep_cluster_capabilities | | | wsrep_cluster_conf_id | 42 | | wsrep_cluster_size | 2 | | wsrep_cluster_state_uuid | dd4d4b72-c8d6-11f0-9edc-0b56129ef20f | | wsrep_cluster_status | Primary | | wsrep_connected | ON | | wsrep_local_bf_aborts | 0 | | wsrep_local_index | 1 | | wsrep_provider_capabilities | :MULTI_MASTER:CERTIFICATION:PARALLEL_APPLYING:TRX_REPLAY:..... | | wsrep_provider_name | Galera | | wsrep_provider_vendor | Codership Oy <info@codership.com> | | wsrep_provider_version | 26.4.22(rXXXX) | | wsrep_ready | ON | | wsrep_rollbacker_thread_count | 1 | | wsrep_thread_count | 2 | +-------------------------------+----------------------------------------------------------------+ 72 rows in set (0.001 sec) |
| Sponsored Link |
|
|