Galera Cluster:
true multi-master architecture, any node can read and write , synchronous replication, no delay between the nodes and the node downtime will not result in data loss.
Environment: CentOS 7
NODE01 172.16.6.90
NODE02 172.16.6.91
NODE03 172.16.6.92
The mating process:
1. Turn off the firewall, disable booting, and disable SELinux (three nodes are executed)
[Email protected] ~]# systemctl stop Firewalld.service #停止firewall
[Email protected] ~]# systemctl disable Firewalld.service #禁止firewall开机启动
[Email protected] ~]# Setenforce 0
[Email protected] ~]# Vi/etc/selinux/config
Change Selinux=enforcing to Selinux=disabled
2. Configure the Mariadb,yum source (three nodes are executed)
[Email protected] ~]# Vi/etc/yum.repos.d/mariadb.repo
[MARIADB]
Name = MariaDB
baseurl=http://yum.mariadb.org/10.0.25/centos7-amd64/
Enabled=1
Gpgcheck=0
3.yum installation Mariadb-galera-server (three nodes are executed)
[email protected] ~]# Yum install Mariadb-galera-server
4. Configuring Galera-server (node One execution)
[Email protected] ~]# VI/ETC/MY.CNF.D/SERVER.CNF
[Galera]
# Mandatory Settings
Wsrep_provider=/usr/lib64/galera/libgalera_smm.so
Wsrep_cluster_address= "gcomm://172.16.6.90,172.16.6.91,172.16.6.92"
Wsrep_cluster_name= ' Mycluster '
Binlog_format=row
Default_storage_engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
#
# Optional Setting
#wsrep_slave_threads =1
#innodb_flush_log_at_trx_commit =0
5. Copy the configuration file to Node02, NODE03 (node one execution)
[Email protected] ~]# scp/etc/my.cnf.d/server.cnf node02:/etc/my.cnf.d/
[Email protected] ~]# scp/etc/my.cnf.d/server.cnf node03:/etc/my.cnf.d/
6. Initialize Glaera Cluster (node one execution)
[Email protected] ~]#/etc/rc.d/init.d/mysql start--wsrep-new-cluster
Starting MySQL success!
7. Start node two, node three
[[Email protected] ~]# service MySQL restart
Shutting down MySQL. success!
Starting MySQL ... SST in progress, setting sleep higher. success!
[[Email protected] ~]# service MySQL restart
Shutting down MySQL. success!
Starting MySQL. SST in progress, setting sleep higher. success!
8. View Port Monitoring Status
[Email protected] ~]# Netstat-plantu | grep mysqld
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2509/mysqld
TCP 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 2509/mysqld
TCP 0 0 172.16.6.90:4567 172.16.6.92:45507 established 2509/mysqld
TCP 0 0 172.16.6.90:4567 172.16.6.91:40237 established 2509/mysqld
MariaDB Galera cluster installation