I. Overview
MariaDB Galera Cluster is a synchronous multi-master cluster of MariaDB. It is available only on Linux, and supports only XtraDB / InnoDB storage engine. Galera itself is a multi-master properties, which uses multi-master cluster architecture, is both a robust, high-availability solutions and have excelled in data consistency, integrity and high performance aspects.
MariaDB 10.1 and later no longer have a separate MariaDB Galera Cluster version. Just download MariaDB (10.1 or later) and correctly configured cluster can be.
Second, combat
Preparing three CentOS7.6 VM (at least three)
1, the server 3 are disposed on the source yum, installation mariadb galera
vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@localhost ~]# yum clean all
[root@localhost ~]# yum repolist
Installation with yum
yum -y install MariaDB-server
2,3 servers were shut down firewall, selinux, configure DNS
192.168.43.164 Galera01
192.168.43.165 Galera02
192.168.43.166 Galera03
3, start mariadb service, initialize the database, remote account authorization
# systemctl start mariadb
# mysqladmin -uroot password "123456";
# MariaDB [(none)]> grant all privileges on *.* to wrsp@'%' identified by '123456';
MariaDB [(none)]> flush privileges;
### remote authentication, it is important ###
Verification of the remote connection of the remaining two on each host
mysql -h 192.168.43.165 -u wrsp -p123456
4, close the database service, configuration galera
# systemctl stop mariadb
# vim /etc/my.cnf.d/server.cnf
[guys]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = "gcomm: //192.168.43.164,192.168.43.165,192.168.43.166" ### three node IP ###
wsrep_node_name = Galera01 ### hostname ### of the machine
wsrep_node_address = 192.168.43.164 ### native IP ###
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=120M
wsrep_sst_method=rsync
wsrep_sst_auth = wrsp: 123456 ### ### empowerment account and password
Copy this file to Galera02, Galera03
Note modifications :
wsrep_node_name=hostname
wsrep_node_address=ip
5, an arbitrarily selected node as the initialization, start galera
# galera_new_cluster
And then start the two remaining
#systemctl start mariadb
6. Verify
Stop any one or two, as long as there is a live, two other restart after data synchronization.