标签:option one row sleep iad family com starting style
Galera Cluster:真正的多主架构,任何节点都可以进行读写,同步复制,各节点间无延迟且节点宕机不会导致数据丢失。
环境:CentOS 7
node01 172.16.6.90
node02 172.16.6.91
node03 172.16.6.92
配置过程:
1、关闭防火墙、禁止开机启动、关闭SELinux(三个节点都执行)
[root@node01 ~]# systemctl stop firewalld.service #停止firewall
[root@node01 ~]# systemctl disable firewalld.service #禁止firewall开机启动
[root@node01 ~]# setenforce 0
[root@node01 ~]# vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
2.配置mariadb,yum源(三个节点都执行)
[root@node01 ~]# 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安装MariaDB-Galera-server(三个节点都执行)
[root@node01 ~]# yum install MariaDB-Galera-server
4.配置galera-server(节点一执行)
[root@node01 ~]# 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.将配置文件拷贝到node02、node03(节点一执行)
[root@node01 ~]# scp /etc/my.cnf.d/server.cnf node02:/etc/my.cnf.d/
[root@node01 ~]# scp /etc/my.cnf.d/server.cnf node03:/etc/my.cnf.d/
6.初始化Glaera Cluster(节点一执行)
[root@node01 ~]# /etc/rc.d/init.d/mysql start --wsrep-new-cluster
Starting MySQL SUCCESS!
7.启动节点二、节点三
[root@node02 ~]# service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL...SST in progress, setting sleep higher. SUCCESS!
[root@node03 ~]# service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL..SST in progress, setting sleep higher. SUCCESS!
8.查看端口监控状态
[root@node01 ~]# 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
标签:option one row sleep iad family com starting style
原文地址:http://blog.51cto.com/perper/2061470