Saturday, May 20, 2023

.::: Adding a node to existing MariaDB Galera Cluster :::.


1. additional hosts node at hosts <add node3= teguhth03>
[root@teguhth01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.15 loadbalancer
10.10.10.11 teguhth01
10.10.10.12 teguhth02
10.10.10.13 teguhth03
[root@teguhth01 ~]#

[root@teguhth02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.15 loadbalancer
10.10.10.11 teguhth01
10.10.10.12 teguhth02
10.10.10.13 teguhth03
[root@teguhth02 ~]#

[root@teguhth03 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.15 loadbalancer
10.10.10.11 teguhth01
10.10.10.12 teguhth02
10.10.10.13 teguhth03
[root@teguhth03 ~]#

2. check existing galera status before add node
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 


3. capture configuration node1 original
cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name

[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12"
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
wsrep_node_address= "10.10.10.11"
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
wsrep_node_name="teguhth01"
[root@teguhth01 ~]#

4. add node1 in configuration
[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,10.10.10.13"
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"

#wsrep_sst_auth=teguh:triharto
...............

[root@teguhth01 ~]#

5. restart mariadb01
[root@teguhth01 ~]# systemctl restart mariadb
[root@teguhth01 ~]#


6. check existing galera status after add node in node1
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12,10.10.10.13"
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
wsrep_node_address= "10.10.10.11"
[root@teguhth01 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
wsrep_node_name="teguhth01"
[root@teguhth01 ~]#

7. check galera status in node1
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 


8. capture configuration node2 original
cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name

[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12"
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
wsrep_node_address= "10.10.10.12"
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
wsrep_node_name="teguhth02"
[root@teguhth02 ~]#


9. add node2 in configuration
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf
.........................
[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,10.10.10.13"
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@teguhth02 ~]#


10. restart mariadb02
[root@teguhth02 ~]# systemctl restart mariadb
[root@teguhth02 ~]#

11. check existing galera status after add node in node2
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12,10.10.10.13"
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
wsrep_node_address= "10.10.10.12"
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
wsrep_node_name="teguhth02"
[root@teguhth02 ~]#

12. check galera status in node2 after add
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 

13. check galera status before add node3 in node3
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 

14. capture configuration node3 original
cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name

[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
[root@teguhth03 ~]#

15. add node3 in configuration
[root@teguhth02 ~]# cat /etc/my.cnf.d/server.cnf
.........................
[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,10.10.10.13"
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.13"
wsrep_node_name="teguhth03"

#wsrep_sst_auth=teguh:triharto
..............

[root@teguhth02 ~]#

16. restart mariadb03
[root@teguhth03 ~]# systemctl restart mariadb
[root@teguhth03 ~]#

17. check existing galera status after add node in node3

[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_cluster_address
#wsrep_cluster_address=
wsrep_cluster_address="gcomm://10.10.10.11,10.10.10.12,10.10.10.13"
[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_address
wsrep_node_address= "10.10.10.13"
[root@teguhth03 ~]# cat /etc/my.cnf.d/server.cnf | grep wsrep_node_name
wsrep_node_name="teguhth03"
[root@teguhth03 ~]#
 
18. check galera status in node3 after add
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 


19. check galera status in node1 after add
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';
 

20. check galera status in node2 after add
show status like 'wsrep_incoming_addresses';
show status like 'wsrep_cluster_weight';
show status like 'wsrep_cluster_size';
show status like 'wsrep_connected';

 

No comments:

Post a Comment

Popular Posts