Percona XtraDB Cluster 测试

本文详细记录了Percona XtraDB Cluster的测试过程,包括Multi-Primary和Arbitrator两种模式下的节点故障、恢复等各种场景。测试显示PXC在数据一致性、性能和网络分区处理方面表现优秀,尤其是在不依赖binlog的情况下。此外,文章还提到了PXC相对于其他解决方案的强一致性优势,并列举了官方的一些限制条件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值