您好,登錄后才能下訂單哦!
文章借鑒: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 &
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。