MariaDB Cluster 10.1 – Unable to Add Extra Node

clusteringmariadbmariadb-10.1MySQLredhat

I was installing a test mariadb cluster but I have a problem when I want to add an extra node. Both nodes use Red Hat Enterprise Linux Server release 7.3 (Maipo)

These were the following steps:

On first node 192.168.1.10. MariaDB-server 10.1.20 installed

1) #vi /etc/my.cnf.d/server.cnf

[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://192.168.1.10,192.168.1.20"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
# start added lines
wsrep_node_address='192.168.1.10'
wsrep_node_name='galera-db01'
wsrep_cluster_name='cluster-test'
wsrep_sst_method = rsync
# end added lines
#
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=2

2) #galera_new_cluster. No errors.

3) #mysql -uroot -e "show status like 'wsrep_cluster%'"

+--------------------------+--------------------------------------+
| Variable_name            | Value                                |
+--------------------------+--------------------------------------+
| wsrep_cluster_conf_id    | 1                                    |
| wsrep_cluster_size       | 1                                    |
| wsrep_cluster_state_uuid | 0f2debe9-fa32-11e7-9d57-5b2cd22cad06 |
| wsrep_cluster_status     | Primary                              |
+--------------------------+--------------------------------------+

4)
Next. I created a database with one table and one record added.

#mysql –uroot
MariaDB [(none)]> create database dbexample;
MariaDB [(none)]> use dbemaxple
MariaDB [(none)]> create table tblemp(name varchar(50));
MariaDB [(none)]> insert into tblemp values('John');

It looks like it’s working well on first node.

On second node (192.168.1.20). MariaDB-server 10.1.20 installed.

5) #vi /etc/my.cnf.d/server.cnf

[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://192.168.1.10,192.168.1.20"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
# start added
wsrep_node_address='192.168.1.20'
wsrep_node_name='galera-db02'
wsrep_cluster_name='cluster-test'
wsrep_sst_method = rsync
# end added
#
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=2

6) #service mysql start

Starting mysql (via systemctl):  Job for mariadb.service failed 
becausethe control process exited with error code. See "systemctl status 
mariadb.service" and "journalctl -xe" for details.
                                                       [FAILED]

7)#systemctl status mariadb.service -l

â mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; 
vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           ââmigrated-from-my.cnf-settings.conf
   Active: failed (Result: exit-code) since lun 2018-01-15 17:37:02 PET;  54s ago
  Process: 18195 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 18116 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 18114 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 18195 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

ene 15 17:37:01 cluster4.local mysqld[18195]: at gcomm/src/pc.cpp:connect():158
ene 15 17:37:01 cluster4.local mysqld[18195]: 2018-01-15 17:37:01 140448459192576 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():208:  Failed to open backend connection: -110 (Connection timed out)
ene 15 17:37:01 cluster4.local mysqld[18195]: 2018-01-15 17:37:01 140448459192576 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1380: Failed to open channel 'cluster-test' at 'gcomm://192.168.1.10,192.168.1.20': -110 (Connection timed out)
ene 15 17:37:01 cluster4.local mysqld[18195]: 2018-01-15 17:37:01 140448459192576 [ERROR] WSREP: gcs connect failed: Connection timed out
ene 15 17:37:01 cluster4.local mysqld[18195]: 2018-01-15 17:37:01 140448459192576 [ERROR] WSREP: wsrep::connect(gcomm://192.168.1.10,192.168.1.20) failed: 7
ene 15 17:37:01 cluster4.local mysqld[18195]: 2018-01-15 17:37:01 140448459192576 [ERROR] Aborting
ene 15 17:37:02 cluster4.local systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
ene 15 17:37:02 cluster4.local systemd[1]: Failed to start MariaDB database server.
ene 15 17:37:02 cluster4.local systemd[1]: Unit mariadb.service entered failed state.
ene 15 17:37:02 cluster4.local systemd[1]: mariadb.service failed.

So the question is what is missing in order to add the second node?

Best Answer

It seems the error is related to the connection.

First, on server 2, Check can you ping(ICMP) server 1?

If you can't check your connection.

But if you can, It's related to Firewall restrict.

In MariaDB Galera Cluster these ports must be open on all servers.

22 (ssh) if you want to use rsync
3306 (MySQL)
4444 (Rsync/ SST)
4567 (Galera)
4568 (Galera IST)