码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7搭建Galera Cluster(5.7)

时间:2020-03-18 13:46:48      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:lock   status   form   The   lib64   tar   新建   smm   method   

CentOS7搭建Galera Cluster(5.7):

rpm下载网址:
http://galeracluster.com/downloads/

第1台:

安装:

yum install perl net-tools lsof socat perl-JSON perl-Data-Dumper libaio openssl-devel

rpm -e postfix

rpm -U /space/setup/5.7/mysql-wsrep-server-5.7-5.7.29-25.21.el7.x86_64.rpm /space/setup/5.7/mysql-wsrep-common-5.7-5.7.29-25.21.el7.x86_64.rpm /space/setup/5.7/mysql-wsrep-client-5.7-5.7.29-25.21.el7.x86_64.rpm /space/setup/5.7/mysql-wsrep-libs-5.7-5.7.29-25.21.el7.x86_64.rpm

yum install boost-devel rsync

rpm -i /space/setup/5.7/galera-3-25.3.29-1.el7.x86_64.rpm

mkdir /space/mysqldb/mysql -p

mkdir /space/mysqldb/mysql_logs

chown mysql /space/mysqldb -R

vi /etc/my.cnf (已有的全清空)

[mysqld]
datadir=/space/mysqldb/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

symbolic-links=0

binlog_format=ROW
bind-address=0.0.0.0
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
wsrep_cluster_name=‘ming‘
wsrep-provider=/usr/lib64/galera-3/libgalera_smm.so
wsrep_cluster_address="gcomm://"
wsrep_node_name=galeraqa01
wsrep_node_address=10.0.1.3
wsrep_sst_method=rsync
wsrep_sst_auth=ming:xxxxx

log-error=/space/mysqldb/mysql_logs/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

:wq

systemctl start mysqld

systemctl enable mysqld

破解mysql root密码(没找到默认密码)

vi /etc/my.cnf

skip-grant-tables

:wq

systemctl restart mysqld

mysql

use mysql;
update user set authentication_string=password(‘xxxxx‘) where user=‘root‘;
exit

vi /etc/my.cnf

#skip-grant-tables

:wq

systemctl restart mysqld

mysql -u root -p‘xxxxx‘

alter user root@‘localhost‘ identified by ‘xxxxxx‘;
show databases;
grant all on . to ming@‘10.0.1.%‘ identified by ‘xxxxx‘;
show status like ‘wsrep_%‘;

别忘了firewall和selinux,没特别要求可以关掉

第2台:

除了下面部分调整下,其它都同第1台

wsrep_cluster_address="gcomm://10.0.1.2,10.0.1.3,10.0.1.4"
wsrep_node_name=galeraqa02
wsrep_node_address=10.0.1.4

第3台:

除了下面部分调整下,其它都同第1台

wsrep_cluster_address="gcomm://10.0.1.2,10.0.1.3,10.0.1.4"
wsrep_node_name=galeraqa03
wsrep_node_address=10.0.1.5

最终通过 show status like ‘wsrep_%‘; 能看到3台就说明都在集群里了

验证:

在任1台上新建库,另2台上会自动同步就说明没问题了。

CentOS7搭建Galera Cluster(5.7)

标签:lock   status   form   The   lib64   tar   新建   smm   method   

原文地址:https://blog.51cto.com/yangzhiming/2479593

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