美文网首页
Galera Cluster for MySQL集群搭建

Galera Cluster for MySQL集群搭建

作者: 天空在微笑 | 来源:发表于2018-01-23 18:55 被阅读146次

Getting Started with MariaDB Galera
Ubuntu 16.04 阿里云更新源
dpkg ---- apt-get ------ aptitude 三种方式的区别 及命令格式

1. 安装MariaDB Galera

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64,i386] http://mirror.fibergrid.in/mariadbrepo/10.1/ubuntu xenial main'

sudo aptitude update
sudo aptitude search mariadb-server-10.3
sudo aptitude install mariadb-server-10.3

2. 关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

3. 配置wsrep文件

在/etc/mysql/conf.d下创建cluster.cnf文件

cp mysqld_safe_syslog.cnf cluster.cnf

然后内容替换成如下:

[galera]
query_cache_size=0
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_type=0
bind-address=0.0.0.0
wsrep_on=ON

# Galera Provider Configuration
wsrep_provider=/usr/lib/galera/libgalera_smm.so

# Galera Cluster Configuration
wsrep_cluster_name="9tree-cluster"
wsrep_cluster_address="gcomm://192.168.231.133,192.168.231.134,192.168.231.135"//所有节点
wsrep_node_address="192.168.231.133"//当前节点
wsrep_node_name="tree00"
wsrep_sst_method=rsync

配置参数:Galera Cluster System Variables
其它两台机器也需要配置。

4. 启动

启动第一节点:

mysqld --wsrep-new-cluster
service mysqld start --wsrep_new_cluster 或者
service mysqld start --galera_new_cluster

启动二三节点:

service mysql start

STARTING THE CLUSTER

5. 测试

TESTING THE CLUSTER

6. 关闭

service mysqld stop

查看log:

sudo tail -100 /var/log/syslog
/var/log/mysql/mysql.log
/etc/mysql/conf.d/mysqld_safe_syslog.cnf

http://galeracluster.com/documentation-webpages/docker.html

相关文章

网友评论

      本文标题:Galera Cluster for MySQL集群搭建

      本文链接:https://www.haomeiwen.com/subject/ktssaxtx.html