yum -y remove mari*
``
# 查看是否已卸载
```sh
rpm -qa |grep mari
#MySQL 对外提供服务的端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
#请求进行全量同步(SST)的端口
firewall-cmd --zone=public --add-port=4444/tcp --permanent
#集群中各个节点间的通讯端口
firewall-cmd --zone=public --add-port=4567/tcp --permanent
#请求进行增量同步(IST)的端口
firewall-cmd --zone=public --add-port=4568/tcp --permanent
firewall-cmd --reload
关闭SELINUX
SELinux 安全模块可能会限制对 Percona XtraDB Cluster 的数据访问。
vi /etc/selinux/config
设置下面的值,保存即可
SELINUX=disabled
修改完成后需要重启服务器: reboot
yum install -y libaio
openssl version
我这里版本是 1.0.2
https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/
wget https://downloads.percona.com/downloads/Percona-XtraDB-Cluster-57/Percona-XtraDB-Cluster-5.7.30-31.43/binary/tarball/Percona-XtraDB-Cluster-5.7.30-rel33-43.1.Linux.x86_64.ssl102.tar.gz
tar -zxvf Percona-XtraDB-Cluster-5.7.30-rel33-43.1.Linux.x86_64.ssl102.tar.gz -C /opt
ln -s /opt/Percona-XtraDB-Cluster-5.7.30-rel33-43.1.Linux.x86_64.ssl102/ /usr/local/mysql
groupadd mysql
useradd -M -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
mkdir -p /database/mysql/data/3306
chown mysql:mysql /database/mysql/data/3306 -R
echo 'export PATH=/usr/local/mysql/bin/:$PATH' >>/etc/profile
source /etc/profile
[mysqld]
user = mysql
basedir = /usr/local/mysql/
datadir = /database/mysql/data/3306
character_set_server = utf8
log_timestamps = system
skip_name_resolve = 1
lower_case_table_names = 1
server-id = 101
binlog_format = row
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
wsrep_node_name = pxc1
wsrep_node_address = 192.168.56.101:4567
wsrep_provider = /usr/local/mysql/lib/libgalera_smm.so
wsrep_cluster_name = pxc-cluster
wsrep_cluster_address = gcomm://192.168.56.101:4567,192.168.56.102:4567
wsrep_sst_method = xtrabackup-v2
wsrep_sst_auth = sstuser:passw0rd
pxc_strict_mode = ENFORCING
wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.20/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.20-1.el7.x86_64.rpm
yum -y install percona-xtrabackup-24-2.4.20-1.el7.x86_64.rpm
yum -y install qpress socat
mysqld --defaults-file=/etc/my.cnf --initialize-insecure
mysqld_safe --defaults-file=/etc/my.cnf --wsrep-new-cluster &
set password='passw0rd';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passw0rd' WITH GRANT OPTION;
CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'passw0rd';
GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
FLUSH PRIVILEGES;
mysqld_safe --defaults-file=/etc/my.cnf &
show status like 'wsrep%';
wsrep_incoming_addresses 查看集群里的节点地址
wsrep_cluster_size 节点数量
wsrep_cluster_status 集群状态