MySQL PXC部署实践

发布时间:2020-06-21 02:46:09 作者:浮生凤年
来源:网络 阅读:312
文章借鉴:https://www.cnblogs.com/zejin2008/p/5475285.html
yum安装:
wget https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/Percona-XtraDB-Cluster-5.7.24-31.33/binary/redhat/6/x86_64/Percona-XtraDB-Cluster-5.7.24-31.33-r443-el6-x86_64-bundle.tar

二进制安装:
• ssl100: for Debian prior to 9 and Ubuntu prior to 14.04 versions 
• ssl101: for CentOS 6 and CentOS 7
• ssl102: for Debian 9 and Ubuntu versions starting from 14.04
wget https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/Percona-XtraDB-Cluster-5.7.24-31.33/binary/tarball/Percona-XtraDB-Cluster-5.7.24-rel26-31.33.1.Linux.x86_64.ssl100.tar.gz

• 3306 is used for MySQL client connections and SST (State Snapshot Transfer) via mysqldump.
• 4444 is used for SST via rsync and Percona XtraBackup.
• 4567 is used for write-set replication traffic (over TCP) and multicast replication (over TCP and UDP). 
• 4568 is used for IST (Incremental State Transfer).

测试环境部署:192.168.1.221,192.168.1.222,192.168.1.223
环境准备
全部节点如下配置:
mkdir -p /data/mysql/3307/{binlog,conf,data,log,pid,socket,tmp}
chown -R mysql.mysql /data/mysql
mv Percona-XtraDB-Cluster-5.7.24-rel26-31.33.1.Linux.x86_64.ssl101 /usr/local/Percona-XtraDB-Cluster-5.7.24
每个节点都需要按照xtrabackup工具,否则后面两个节点无法启动
wget https://repo.percona.com/yum/percona-release-1.0-7.noarch.rpm
rpm -ivh percona-release-1.0-7.noarch.rpm
yum -y install percona-xtrabackup-24.x86_64
如报错: Requires: libev.so.4()(64bit)
则:wget ftp://rpmfind.net/linux/atrpms/el6-x86_64/atrpms/stable/libev-4.04-2.el6.x86_64.rpm
    rpm -ivh libev-4.04-2.el6.x86_64.rpm
同时版本要匹配,percona-xtrabackup-80-8.0.5只使用percona 8.0
每个节点安装socat,socat版本尽量在1.7.3以上
yum install socat
或者
wget http://www.dest-unreach.org/socat/download/socat-1.7.3.2.tar.gz
./configure && make && make install

192.168.1.221修改配置文件,增加如下:
wsrep_provider=/usr/local/Percona-XtraDB-Cluster-5.7.24/lib/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://192.168.1.221,192.168.1.222,192.168.1.223
wsrep_node_name=pxc1
wsrep_node_address=192.168.1.221
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sstuser:passw0rd
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2

192.168.1.222按192.168.1.221增加的修改配置文件如下:
.......
wsrep_node_name=pxc2
wsrep_node_address=192.168.1.222
........
192.168.1.222按192.168.1.221增加的修改配置文件如下:
........
wsrep_node_name=pxc3
wsrep_node_address=192.168.1.223
........

集群第一个节点:221
初始化:
/usr/local/Percona-XtraDB-Cluster-5.7.24/bin/mysqld --defaults-file=/data/mysql/3307/conf/my.cnf  --user=mysql  --initialize
启动,集群中第一个节点启动要加选项 --wsrep-new-cluster
/usr/local/Percona-XtraDB-Cluster-5.7.24/bin/mysqld_safe --defaults-file=/data/mysql/3307/conf/my.cnf --user=mysql --wsrep-new-cluster &
授权
CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'passw0rd';
GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
节点222,223:
/usr/local/Percona-XtraDB-Cluster-5.7.24/bin/mysqld --defaults-file=/data/mysql/3307/conf/my.cnf  --user=mysql  --initialize
/usr/local/Percona-XtraDB-Cluster-5.7.24/bin/mysqld_safe --defaults-file=/data/mysql/3307/conf/my.cnf --user=mysql  &
推荐阅读:
  1. docker化运维部署-mysql 热备份数据讲义
  2. MySQL中PXC集群的介绍

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql pxc 部署

上一篇:企业数据保护需要注意什么

下一篇:Docker镜像保存为文件及从本地文件导入镜像的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》