简介:今天来尝试下 pxc 5.7.20安装
1 环境安装
yum install -y git scons gcc gcc-c++ openssl check cmake bison boost-devel asio-devel libaio-devel ncurses-devel readline-devel pam-devel
2 配置yum源
rpm -ivh http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
3 安装
yum install Percona-XtraDB-Cluster-57 -y
4 配置
node1
1 更改密码
service mysql start
update user set authentication_string=password('root');
flush privileges
service mysql stop
2 修改配置文件
cat > /etc/my.cnf << EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://IP1,IP2
wsrep_node_name=node1
wsrep_node_address=IP1
wsrep_slave_threads= 8
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sstuser:sstuser
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
EOF
node2
1 更改密码
service mysql start
update user set authentication_string=password('root');
flush privileges
service mysql stop
2 修改配置文件
cat > /etc/my.cnf << EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://IP1,IP2
wsrep_node_name=node2
wsrep_node_address=IP2
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sstuser:sstuser
pxc_strict_mode=ENFORCING
wsrep_slave_threads= 8
binlog_format=ROW
default_storage_engine=InnoDB
EOF
5 初始化node1节点作为primary
node1
service mysql start-bootstrap
6 创建同步账号
node1
GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost' IDENTIFIED BY 'sstuser';
flush privileges
7 次节点node2节点插入
service mysql start
8 观察
node1
show status like 'wsrep%'; 过滤 wsrep_cluster_size=2 证明加入成功
9 相关配置说明
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so 插件位置
wsrep_cluster_name 集群名称
wsrep_cluster_address 集群IP集合
wsrep_node_name 本地名称
wsrep_node_address 本地地址
wsrep_sst_method 同步方式 (rsync,mysqldump,xtrabackup-v2) 注意 xtrabackup-v2 一定要填写这个,V2代表的是版本号
wsrep_sst_auth 同步的账号密码
pxc_strict_mode SQL认证模式
10 组件构成
Percona-XtraDB-Cluster-server-57-5.7.20-29.24.1.el6.x86_64
Percona-XtraDB-Cluster-client-57-5.7.20-29.24.1.el6.x86_64
Percona-XtraDB-Cluster-shared-57-5.7.20-29.24.1.el6.x86_64
Percona-XtraDB-Cluster-57-5.7.20-29.24.1.el6.x86_64