MariaDB Galera Cluster安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MariaDB Galera Cluster安装相关的知识,希望对你有一定的参考价值。

Galera Cluster:

  • 真正的多主架构,任何节点都可以进行读写,同步复制,各节点间无延迟且节点宕机不会导致数据丢失。

环境:CentOS 7
 node01 172.16.6.90  
 node02 172.16.6.91
 node03 172.16.6.92
 
置过程:
1、关闭防火墙、禁止开机启动、关闭SELinux(三个节点都执行)
[[email protected] ~]# systemctl stop firewalld.service #停止firewall
[[email protected] ~]# systemctl disable firewalld.service #禁止firewall开机启动
[[email protected] ~]# setenforce 0
[[email protected] ~]# vi /etc/selinux/config
 将SELINUX=enforcing改为SELINUX=disabled
 
2.配置mariadb,yum源(三个节点都执行) 
[[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安装MariaDB-Galera-server(三个节点都执行)
[[email protected] ~]# yum install MariaDB-Galera-server


4.配置galera-server(节点一执行)  
[[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.将配置文件拷贝到node02、node03(节点一执行) 
[[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.初始化Glaera Cluster(节点一执行)
[[email protected] ~]# /etc/rc.d/init.d/mysql start --wsrep-new-cluster
Starting MySQL SUCCESS!


7.启动节点二、节点三
[[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.查看端口监控状态
[[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安装的主要内容,如果未能解决你的问题,请参考以下文章

MariaDB-Galera-cluster实现mariadb高可用的详细步骤

Centos7安装mariadb galera cluster数据库集群 & 详解

CentOS 6.4安装配置MairaDB 10.3 Galera Cluster

Mariadb Galera Cluster 部署

实战Mariadb galera Cluster集群架构

MariaDB Galera Cluster 之二 MariaDB Galera Cluster主要功能优缺点和对比