1 测试环境
HostName |
OS |
MySQL Version |
IP:Port |
CPU |
MEM |
bandwith |
mysql-1 |
CentOS7.3 |
5.7.18-15-57 Percona XtraDB Cluster (GPL) |
10.45.81.189:3306/4444/4567/4568 |
2 |
8G |
10000Mb/s |
mysql-2 |
CentOS7.3 |
5.7.18-15-57 Percona XtraDB Cluster (GPL) |
10.45.81.190:3306/4444/4567/4568 |
2 |
8G |
10000Mb/s |
mysql3 |
CentOS7.3 |
5.7.18-15-57 Percona XtraDB Cluster (GPL) |
10.45.81.191:3306/4444/4567/4568 |
2 |
8G |
10000Mb/s |
测试环境主机为虚拟机
2 安装部署
采用RPM包安装模式
配置my.cnf(PXC必要参数,省略了其他常用配置其他和MGR非插件参数配置一样)
symbolic-links=0 wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
# Cluster connection URL contains IPs of nodes #If no IP is found, this implies that a new cluster needs to be created, #in order to do that you need to bootstrap this node wsrep_cluster_address=gcomm://10.45.81.189,10.45.81.190,10.45.81.191
# In order for Galera to work correctly binlog format should be ROW binlog_format=ROW
# MyISAM storage engine has only experimental support default_storage_engine=InnoDB
# Slave thread to use wsrep_slave_threads= 8
wsrep_log_conflicts
# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera innodb_autoinc_lock_mode=2
# Node IP address wsrep_node_address=10.45.81.189 # Cluster name wsrep_cluster_name=pxc-cluster
#If wsrep_node_name is not specified, then system hostname will be used wsrep_node_name=pxc-cluster-node-1
#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER pxc_strict_mode=ENFORCING
# SST method wsrep_sst_method=xtrabackup-v2
#Authentication for SST method wsrep_sst_auth="sstuser:sstuser" |
初始化
#systemctl start mysql@bootstrap.service |
--配置用户权限--
root@mysql-1[/root]# mysql -uroot -p mysql> alter user root@'localhost' identified by 'root'; Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) --验证状态 mysql> show status like 'wsrep%';
--创建sstuser mysql> CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'sstuser'; Query OK, 0 rows affected (0.00 sec)
mysql> GRANT PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost'; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) |
---其他节点启动
#systemctl start mysql |
--确认启动成功--
mysql> show status like 'wsrep%'; +----------------------------------+-------------------------------------------------------+ | Variable_name | Value | +----------------------------------+-------------------------------------------------------+ | wsrep_local_state_uuid | 491256df-7666-11e7-b95d-eee2b5a469af | | wsrep_protocol_version | 7 | | wsrep_last_committed | 12620603 | | wsrep_replicated | 1 | | wsrep_replicated_bytes | 291 | | wsrep_repl_keys | 3 | | wsrep_repl_keys_bytes | 47 | | wsrep_repl_data_bytes | 180 | | wsrep_repl_other_bytes | 0 | | wsrep_received | 6 | | wsrep_received_bytes | 623 | | wsrep_local_commits | 1 | | wsrep_local_cert_failures | 0 | | wsrep_local_replays | 0 &nb |