MySQLPXC部署实践-创新互联

文章借鉴: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  &

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

创新互联服务项目包括汉南网站建设、汉南网站制作、汉南网页制作以及汉南网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,汉南网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到汉南省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
文章标题:MySQLPXC部署实践-创新互联
URL地址:http://cdiso.cn/article/ceecdh.html

其他资讯