MariaDB Galera Cluster 10.0
CentOS 7
*** Setup MariaDB Galera Cluster 10.0
Cluster node 1 has hostname db1 and IP address 1.1.1.1
Cluster node 2 has hostname db2 and IP address 1.1.1.2
Cluster node 3 has hostname db3 and IP address 1.1.1.3
*** Create MariaDB yum repo file
# vi /etc/yum.repos.d/MariaDB.repo
*** Modify
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/rhel7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
*** Set SELinux in permissive mode
# setenforce0
*** install MariaDB Galera Cluster 10.0
#yum install MariaDB-Galera-server MariaDB-client rsync galera
setup MariaDB security
#systemctl start mariadb
#mysql_secure_installation
*** Create MariaDB Galera Cluster users
#mysql -u root –p
mysql> DELETE FROM mysql.user WHERE user='';
mysql> GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'dbpass';
mysql> GRANT USAGE ON *.* to sst_user@'%' IDENTIFIED BY 'dbpass';
mysql> GRANT ALL PRIVILEGES on *.* to sst_user@'%';
mysql> FLUSH PRIVILEGES;
mysql> quit
*** Create the MariaDB Galera Cluster config
#systemctl stop mariadb
#vi /etc/my.cnf.d/server.cnf
*** Modify
On db1
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
query_cache_size=0
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
innodb_log_file_size=100M
innodb_file_per_table
innodb_flush_log_at_trx_commit=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://1.1.1.1,1.1.1.2,1.1.1.3
wsrep_cluster_name='galera_cluster'
wsrep_node_address='1.1.1.1'
wsrep_node_name='db1'
wsrep_sst_method=rsync
wsrep_sst_auth=sst_user:dbpass
On db2
wsrep_node_address=1.1.1.2
wsrep_node_name='db2'
On db3
wsrep_node_address=1.1.1.3
wsrep_node_name='db3'
*** Initialize the first cluster node
Start MariaDB with the special ‘‐‐wsrep-new-cluster’ option , Do it on node db1 only so the primary node of the cluster is initialized
# /etc/init.d/mysql start --wsrep-new-cluster
*** Check status by run the following command on node db1 only
#mysql-uroot-p-e"show status like 'wsrep%'"