1. Install MariaDB latest
http://teguhth.blogspot.com/2023/05/how-to-install-mariadb-105-or-latest.html
http://teguhth.blogspot.com/2023/05/how-to-install-mariadb-105-or-latest.html
enable /etc/hosts
State Transfers
The process of replicating data from the cluster to the individual node, bringing the node into sync with the cluster, is known as provisioning. There are two methods available in Galera Cluster to provision nodes:
- State Snapshot Transfers (SST) Where a snapshot of the entire node state transfers.
- Incremental State Transfers (IST) Where only the missing transactions transfer.
https://galeracluster.com/library/documentation/state-transfer.html#state-transfer-sst
2. check galera location
[root@teguhth01 ~]# yum install -y mlocate
[root@teguhth01 ~]# updatedb
[root@teguhth01 ~]# locate libgalera_smm.so
/usr/lib64/galera-4/libgalera_smm.so
[root@teguhth01 ~]#
3. stop MariaDB in server 01 & server 02
[root@teguhth01 ~]# systemctl stop mariadb
[root@teguhth01 ~]#
[root@teguhth02 ~]# systemctl stop mariadb
[root@teguhth02 ~]#
4. configure galera in server 01.
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf
#
...............
# * Galera-related settings
#
[galera]
................
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_cluster_name="galeracluster"
wsrep_sst_method=rsync
wsrep_node_address= "10.10.10.11"
wsrep_node_name="teguhth01"
# add wsrep_provider_options if using IST, delete wsrep_provider_options if using SST
wsrep_provider_options="gcache.size=10G"
#wsrep_sst_auth=teguh:triharto
................
[root@teguhth01 ~]#
5. configure galera in server 02.
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf
#
..............
# * Galera-related settings
#
[galera]
# Mandatory settings
................
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_cluster_name="galeracluster"
wsrep_sst_method=rsync
wsrep_node_address= "10.10.10.12"
wsrep_node_name="teguhth02"
#wsrep_sst_auth=teguh:triharto
................
[root@teguhth01 ~]#
5. configure galera in server 02.
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf
#
..............
# * Galera-related settings
#
[galera]
# Mandatory settings
................
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_cluster_name="galeracluster"
wsrep_sst_method=rsync
wsrep_node_address= "10.10.10.12"
wsrep_node_name="teguhth02"
# add wsrep_provider_options if using IST, delete wsrep_provider_options if using SST
wsrep_provider_options="gcache.size=10G"#wsrep_sst_auth=teguh:triharto
...............
[root@teguhth02 ~]#
6. start galera new cluster in server 01
[root@teguhth01 ~]# galera_new_cluster
[root@teguhth01 ~]#
7. start galera in server 02
[root@teguhth02 ~]# systemctl start mariadb
[root@teguhth02 ~]#
8. from server01 - insert data
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test2 |
+--------------------+
4 rows in set (0.000 sec)
MariaDB [(none)]> create database test1;
Query OK, 1 row affected (0.003 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test1 |
| test2 |
+--------------------+
5 rows in set (0.001 sec)
MariaDB [(none)]>
9. from server02 - insert data
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> create database test2;
Query OK, 1 row affected (0.004 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test2 |
+--------------------+
4 rows in set (0.001 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test1 |
| test2 |
+--------------------+
10. check galera status from server01
MariaDB [(none)]> select @@hostname as Hostname, @@version as Version;
+-----------+-----------------+
| Hostname | Version |
+-----------+-----------------+
| teguhth01 | 10.5.20-MariaDB |
+-----------+-----------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
MariaDB [(none)]> show status like 'wsrep%';
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| wsrep_local_state_uuid | e55623c2-f231-11ed-b3eb-c61c9d127f0b |
| wsrep_protocol_version | 10 |
| wsrep_last_committed | 4 |
| wsrep_replicated | 1 |
| wsrep_replicated_bytes | 456 |
| wsrep_repl_keys | 1 |
| wsrep_repl_keys_bytes | 32 |
| wsrep_repl_data_bytes | 360 |
| wsrep_repl_other_bytes | 0 |
| wsrep_received | 7 |
| wsrep_received_bytes | 936 |
| wsrep_local_commits | 0 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_send_queue_avg | 0 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_max | 2 |
| wsrep_local_recv_queue_min | 0 |
| wsrep_local_recv_queue_avg | 0.142857 |
| wsrep_local_cached_downto | 1 |
| 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 | 2 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0 |
| wsrep_open_transactions | 0 |
| wsrep_open_connections | 0 |
| wsrep_incoming_addresses | 10.10.10.11:0,10.10.10.12: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 | e55488fc-f231-11ed-9940-3b2e9fcd99b8 |
| wsrep_gmcast_segment | 0 |
| wsrep_applier_thread_count | 1 |
| wsrep_cluster_capabilities | |
| wsrep_cluster_conf_id | 2 |
| wsrep_cluster_size | 2 |
| wsrep_cluster_state_uuid | e55623c2-f231-11ed-b3eb-c61c9d127f0b |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 0 |
| wsrep_provider_capabilities | :MULTI_MASTER:CERTIFICATION:PARALLEL_APPLYING:TRX_REPLAY:ISOLATION:PAUSE:CAUSAL_READS:INCREMENTAL_WRITESET:UNORDERED:PREORDERED:STREAMING:NBO: |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 26.4.14(r06a0c28) |
| wsrep_ready | ON |
| wsrep_rollbacker_thread_count | 1 |
| wsrep_thread_count | 2 |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
69 rows in set (0.005 sec)
MariaDB [(none)]>
11. check galera status from server02
MariaDB [(none)]> select @@hostname as Hostname, @@version as Version;
+-----------+-----------------+
| Hostname | Version |
+-----------+-----------------+
| teguhth02 | 10.5.20-MariaDB |
+-----------+-----------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
MariaDB [(none)]> show status like 'wsrep%';
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| wsrep_local_state_uuid | e55623c2-f231-11ed-b3eb-c61c9d127f0b |
| wsrep_protocol_version | 10 |
| wsrep_last_committed | 4 |
| wsrep_replicated | 1 |
| wsrep_replicated_bytes | 456 |
| wsrep_repl_keys | 1 |
| wsrep_repl_keys_bytes | 32 |
| wsrep_repl_data_bytes | 360 |
| wsrep_repl_other_bytes | 0 |
| wsrep_received | 4 |
| wsrep_received_bytes | 680 |
| wsrep_local_commits | 0 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_send_queue_avg | 0 |
| 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 | 2 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0 |
| wsrep_open_transactions | 0 |
| wsrep_open_connections | 0 |
| wsrep_incoming_addresses | 10.10.10.11:0,10.10.10.12: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 | eaac9d2c-f231-11ed-a3d0-6ebe23c3aca8 |
| wsrep_gmcast_segment | 0 |
| wsrep_applier_thread_count | 1 |
| wsrep_cluster_capabilities | |
| wsrep_cluster_conf_id | 2 |
| wsrep_cluster_size | 2 |
| wsrep_cluster_state_uuid | e55623c2-f231-11ed-b3eb-c61c9d127f0b |
| 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:ISOLATION:PAUSE:CAUSAL_READS:INCREMENTAL_WRITESET:UNORDERED:PREORDERED:STREAMING:NBO: |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 26.4.14(r06a0c28) |
| wsrep_ready | ON |
| wsrep_rollbacker_thread_count | 1 |
| wsrep_thread_count | 2 |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
69 rows in set (0.002 sec)
MariaDB [(none)]>
capture simple
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
No comments:
Post a Comment