码迷,mamicode.com
首页 > 数据库 > 详细

MariaDB Galera Cluster的配置测试

时间:2015-03-11 14:20:15      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

参考的https://fykuan.hsnuer.net/blog/2015/01/23/debian-%E4%B8%8A%E5%AE%89%E8%A3%9D-mariadb-galera-cluster/

 

ip列表

192.168.1.119(主)
192.168.1.115

 

主从都装

sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository ‘http://mirrors.ustc.edu.cn/mariadb/repo/10.1/debian/ wheezy main

sudo apt-get update
sudo apt-get install mariadb-galera-server

 

配置用户

mysql -uroot -p

这里要先创建个用户cluster
mysql> GRANT USAGE ON *.* TO cluster@% IDENTIFIED BY abcdefg;
mysql> GRANT ALL PRIVILEGES ON *.* TO cluster@%;
mysql> GRANT USAGE ON *.* TO cluster@localhost IDENTIFIED BY abcdefg;
mysql> GRANT ALL PRIVILEGES ON *.* TO cluster@localhost;
mysql> FLUSH ALL PRIVILEGES;

 

master上

sudo cp /usr/share/mysql/wsrep.conf /etc/mysql/conf.d

改成下面

[MYSQLD]
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
wsrep_cluster_name="my_cluster"
wsrep_node_address=192.168.1.119

#下面这行不能缺
wsrep_cluster_address="gcomm://"
wsrep_sst_method=rsync

#这是用来同步的用户
wsrep_sst_auth=cluster:abcdefg

 

从机

[MYSQLD]
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
wsrep_cluster_name="my_cluster"
wsrep_node_address=192.168.1.115

wsrep_cluster_address="gcomm://192.168.1.119"
wsrep_sst_method=rsync

#这是用来同步的用户
wsrep_sst_auth=cluster:abcdefg

 

测试可以多主写入,主挂掉,从自动变主

MariaDB Galera Cluster的配置测试

标签:

原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/4329535.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!