Reputation: 750
I'm trying to setup a galera MariaDB 10.1 cluster on Centos 7. Here is my master configuration:
[mysqld]
wsrep_cluster_address="gcomm://10.47.246.45,10.47.246.9"
wsrep_node_address="10.47.246.45"
wsrep_node_name='n1'
wsrep_cluster_name='cluster'
innodb_buffer_pool_size=400M
# Mandatory settings to enable Galera
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
default-storage-engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0
bind-address=0.0.0.0
# Galera synchronisation configuration
wsrep_sst_method=rsync
and when I type
SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
I get this output
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 1 |
+--------------------+-------+
Here is the configuration on the node I'm trying to add
[mysqld]
wsrep_cluster_address="gcomm://10.47.246.45,10.47.246.9"
wsrep_node_address="10.47.246.9"
wsrep_node_name='n2'
wsrep_cluster_name='cluster'
innodb_buffer_pool_size=400M
# Mandatory settings to enable Galera
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
default-storage-engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0
bind-address=0.0.0.0
# Galera synchronisation configuration
wsrep_sst_method=rsync
and mysql service starts without any errors using:
service mysql start --wsrep-new-cluster
and this is the output from
SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
I get his output
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 0 |
+--------------------+-------+
Any idea what could be wrong with my configuration?
Upvotes: 0
Views: 1076
Reputation: 157
I had the same problem, each of ny nodes seemed to start their own little 1-node cluster. Solution: Look in /usr/lib/systemd/system/mariadb.service about line 30:
ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
Except for node 10.47.246.45, on all others remove $ WSREP_NEW_CLUSTER and save the configuration. Make sure you start with galera_new_cluster on 10.47.246.45 and once it is running start the other nodes one by one with systemctl start mysql (or service mysql start)
Upvotes: 0
Reputation: 28593
First of all I want to suggest to use minimum three nodes in Galera cluster to prevent split braining there.
The correct configuration related to Galera cluster settings for the first host is (the others should have the same template):
[mysqld]
log_error = /var/log/mysql/mysql-error.log
default_storage_engine = InnoDB
binlog_format = ROW
wsrep_on = ON
wsrep_provider = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = "gcomm://<node1_ip>,<node2_ip>,<node3_ip>"
wsrep_cluster_name = cluster
wsrep_node_name = <node1_name>
wsrep_node_address = <node1_ip>
innodb_autoinc_lock_mod = 2
wsrep_sst_method = rsync
To start Galera cluster just do the following on the first node:
# galera_new_cluster
Check that your cluster has been created:
# mysql -e "show status like '%wsrep_cluster%'"
+--------------------------+--------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------+
| wsrep_cluster_conf_id | 1234 |
| wsrep_cluster_size | 1 |
| wsrep_cluster_state_uuid | 020e3d69-2b31-11e7-9723-4b205d7b7e0c |
| wsrep_cluster_status | Primary |
+--------------------------+--------------------------------------+
And start MariaDB
on the other hosts:
systemctl start mariadb
Nodes should join your Galera cluster.
If it is not working still, follow logs in /var/log/mysql/mysql-error.log
Upvotes: 1