pxc优点总结:
可以达到时时同步,无延迟现象发生
完全兼容MySQL
对于集群中新节点的加入,维护起来很简单
数据的强一致性
不足之处总结:
只支持Innodb存储引擎
存在多节点update更新问题,也就是写放大问题
在线DDL语句,锁表问题
sst针对新节点加入的传输代价过高的问题

关于写放大的原理图

下面从上次组复制转pxc

https://www.cnblogs.com/omsql/p/9277047.html

pxc架构图如下

卸载mysql

卸载前记得备份my.cnf

yum remove mysql-community-*

安装pxc

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm
yum install http://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/socat-1.7.2.4-1.el6.rf.x86_64.rpm
yum install Percona-XtraDB-Cluster-57

修改my.cnf

#pxc
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.20.201,192.168.20.202,192.168.20.203
wsrep_slave_threads= 8
innodb_autoinc_lock_mode=2
wsrep_node_address=192.168.20.201
wsrep_cluster_name=ht-pxc-cluster
wsrep_node_name=pxc01
pxc_strict_mode=ENFORCING
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sst:ocm123

第一个节点启动
/etc/init.d/mysqld bootstrap-pxc
创建用户
SHOW VARIABLES LIKE 'validate_password%';
set global validate_password_policy=LOW;
set global validate_password_length=4;
create user 'sst'@'localhost' identified by 'ocm123';
grant all privileges on *.* to 'sst'@'localhost' identified by 'ocm123';
flush privileges;

第二个节点启动
/etc/init.d/mysql start
第三个节点启动
/etc/init.d/mysql start

  添加第三个节点redis03的时候redis02日志输出如下

 redis02
--09T15::.004758Z [Note] WSREP: Member 2.0 (pxc03) requested state transfer from '*any*'. Selected 0.0 (pxc02)(SYNCED) as donor.
--09T15::.004800Z [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: )
--09T15::.004867Z [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
--09T15::.005039Z [Note] WSREP: Initiating SST/IST transfer on DONOR side (wsrep_sst_xtrabackup-v2 --role 'donor' --address '192.168.20.203:4444/xtrabackup_sst//1' --socket '/data/mysql/mysql.sock' --datadir '/data/mysql/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --binlog 'mysql-bin' --gtid '62e9006b-8379-11e8-bc64-874d49a77c07:7054')
--09T15::.087469Z [Note] WSREP: DONOR thread signaled with

redis02被选为donar,使用xtrabackup备份整个库传到redis03下,同时查看redis03  /data/mysql

[root@redis03 mysql]# ls
galera.cache grastate.dat gvwstate.dat sst_in_progress

恢复完后如下

 [root@redis03 mysql]# ls
auto.cnf grastate.dat ib_logfile1 mysql-bin. public_key.pem server-cert.pem xtrabackup_info
ca-key.pem gvwstate.dat ibtmp1 mysql-bin.index pxc server-key.pem xtrabackup_master_key_id
ca.pem ht innobackup.move.log mysql.sock redis03-relay-bin-group_replication_applier. sys
client-cert.pem ib_buffer_pool innobackup.prepare.log mysql.sock.lock redis03-relay-bin-group_replication_applier.index xb_doublewrite
client-key.pem ibdata1 mysql performance_schema redis03-relay-bin-group_replication_recovery. xtrabackup_binlog_pos_innodb
galera.cache ib_logfile0 mysql-bin. private_key.pem redis03-relay-bin-group_replication_recovery.index xtrabackup_galera_info

上面输出可以看出sst针对新节点加入的传输代价过高。

查看集群状态

root@redis03> show status like 'wsrep%';
+----------------------------------+-------------------------------------------------------------+
| Variable_name | Value |
+----------------------------------+-------------------------------------------------------------+
| wsrep_local_state_uuid | 62e9006b--11e8-bc64-874d49a77c07 |
| wsrep_protocol_version | |
| wsrep_last_applied | |
| wsrep_last_committed | |
| wsrep_replicated | |
| wsrep_replicated_bytes | |
| wsrep_repl_keys | |
| wsrep_repl_keys_bytes | |
| wsrep_repl_data_bytes | |
| wsrep_repl_other_bytes | |
| wsrep_received | |
| wsrep_received_bytes | |
| wsrep_local_commits | |
| wsrep_local_cert_failures | |
| wsrep_local_replays | |
| wsrep_local_send_queue | |
| wsrep_local_send_queue_max | |
| wsrep_local_send_queue_min | |
| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_recv_queue | |
| wsrep_local_recv_queue_max | |
| wsrep_local_recv_queue_min | |
| wsrep_local_recv_queue_avg | 0.000000 |
| wsrep_local_cached_downto | |
| wsrep_flow_control_paused_ns | |
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_sent | |
| wsrep_flow_control_recv | |
| wsrep_flow_control_interval | [ , ] |
| wsrep_flow_control_interval_low | |
| wsrep_flow_control_interval_high | |
| wsrep_flow_control_status | OFF |
| wsrep_cert_deps_distance | 0.000000 |
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 0.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 0.000000 |
| wsrep_local_state | |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | |
| wsrep_cert_bucket_count | |
| wsrep_gcache_pool_size | |
| wsrep_causal_reads | |
| wsrep_cert_interval | 0.000000 |
| wsrep_ist_receive_status | |
| wsrep_ist_receive_seqno_start | |
| wsrep_ist_receive_seqno_current | |
| wsrep_ist_receive_seqno_end | |
| wsrep_incoming_addresses | 192.168.20.202:,192.168.20.201:,192.168.20.203: |
| wsrep_desync_count | |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | //// |
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | ee9c63ef--11e8-af36-8bf4f2f07974 |
| wsrep_cluster_conf_id | |
| wsrep_cluster_size | |
| wsrep_cluster_state_uuid | 62e9006b--11e8-bc64-874d49a77c07 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | |
| wsrep_local_index | |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 3.26(rac090bc) |
| wsrep_ready | ON |
+----------------------------------+-------------------------------------------------------------+

在对pxc做此oltp测试

安装sysbench
yum install sysbench
生成数据,创建10个表,每个表百万行
sysbench oltp_common --tables=10 --table-size=1000000 --db-driver=mysql --mysql-db=pxc --mysql-user=root --mysql-password=ocm123 prepare oltp 测试,开启50个并行
sysbench oltp_read_write.lua --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-db=pxc --mysql-user=root --mysql-password=ocm123 --table_size=1000000 --tables=10 --threads=50 --report-interval=10 --time=300 run

  oltp测试结果如下

 [root@redis01 sysbench]# sysbench oltp_read_write.lua --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port= --mysql-db=pxc --mysql-user=root --mysql-password=ocm123 --table_size=  --tables= --threads= --report-interval= --time=  run
sysbench 1.0. (using bundled LuaJIT 2.1.-beta2) Running the test with following options:
Number of threads:
Report intermediate results every second(s)
Initializing random number generator from current time Initializing worker threads... Threads started! [ 10s ] thds: tps: 7.90 qps: 231.92 (r/w/o: 168.04/26.19/37.69) lat (ms,%): 5813.24 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: tps: 11.80 qps: 254.99 (r/w/o: 177.69/32.30/45.00) lat (ms,%): 5918.87 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: tps: 8.90 qps: 179.97 (r/w/o: 124.58/26.10/29.30) lat (ms,%): 6476.48 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: tps: 10.40 qps: 175.17 (r/w/o: 122.35/19.81/33.01) lat (ms,%): 9284.15 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: tps: 9.20 qps: 182.49 (r/w/o: 131.10/21.90/29.50) lat (ms,%): 9799.46 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: tps: 8.80 qps: 198.65 (r/w/o: 140.97/24.39/33.29) lat (ms,%): 7215.39 err/s: 0.00 reconn/s: 0.00
[ 70s ] thds: tps: 7.00 qps: 145.72 (r/w/o: 99.01/21.60/25.10) lat (ms,%): 8795.93 err/s: 0.00 reconn/s: 0.00
[ 80s ] thds: tps: 13.70 qps: 239.41 (r/w/o: 171.21/27.20/41.00) lat (ms,%): 8484.79 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: tps: 7.40 qps: 161.92 (r/w/o: 107.41/24.90/29.60) lat (ms,%): 8484.79 err/s: 0.00 reconn/s: 0.00
[ 100s ] thds: tps: 8.00 qps: 186.69 (r/w/o: 130.99/24.00/31.70) lat (ms,%): 5918.87 err/s: 0.00 reconn/s: 0.00
[ 110s ] thds: tps: 10.00 qps: 200.01 (r/w/o: 140.00/27.40/32.60) lat (ms,%): 5709.50 err/s: 0.00 reconn/s: 0.00
[ 120s ] thds: tps: 10.60 qps: 210.17 (r/w/o: 148.38/25.60/36.19) lat (ms,%): 8184.67 err/s: 0.00 reconn/s: 0.00
[ 130s ] thds: tps: 11.50 qps: 223.73 (r/w/o: 159.42/24.70/39.61) lat (ms,%): 7895.16 err/s: 0.00 reconn/s: 0.00
[ 140s ] thds: tps: 11.90 qps: 242.60 (r/w/o: 168.03/31.09/43.48) lat (ms,%): 4943.53 err/s: 0.00 reconn/s: 0.00
[ 150s ] thds: tps: 9.10 qps: 185.45 (r/w/o: 127.53/26.21/31.71) lat (ms,%): 4517.90 err/s: 0.00 reconn/s: 0.00
[ 160s ] thds: tps: 14.50 qps: 253.44 (r/w/o: 179.83/27.70/45.91) lat (ms,%): 8184.67 err/s: 0.00 reconn/s: 0.00
[ 170s ] thds: tps: 8.40 qps: 203.91 (r/w/o: 140.80/28.10/35.00) lat (ms,%): 4943.53 err/s: 0.00 reconn/s: 0.00
[ 180s ] thds: tps: 13.90 qps: 261.61 (r/w/o: 187.64/28.89/45.08) lat (ms,%): 7754.26 err/s: 0.00 reconn/s: 0.00
[ 190s ] thds: tps: 10.50 qps: 226.94 (r/w/o: 153.93/35.31/37.71) lat (ms,%): 7754.26 err/s: 0.00 reconn/s: 0.00
[ 200s ] thds: tps: 12.00 qps: 218.73 (r/w/o: 153.52/25.30/39.91) lat (ms,%): 4203.93 err/s: 0.00 reconn/s: 0.00
[ 210s ] thds: tps: 11.80 qps: 249.64 (r/w/o: 177.76/29.89/41.99) lat (ms,%): 5607.61 err/s: 0.00 reconn/s: 0.00
[ 220s ] thds: tps: 12.69 qps: 256.80 (r/w/o: 178.93/30.99/46.88) lat (ms,%): 4517.90 err/s: 0.00 reconn/s: 0.00
[ 230s ] thds: tps: 14.01 qps: 253.05 (r/w/o: 180.41/27.62/45.03) lat (ms,%): 5709.50 err/s: 0.00 reconn/s: 0.00
[ 240s ] thds: tps: 9.20 qps: 211.70 (r/w/o: 145.10/31.10/35.50) lat (ms,%): 5507.54 err/s: 0.00 reconn/s: 0.00
[ 250s ] thds: tps: 14.10 qps: 259.32 (r/w/o: 186.52/29.30/43.50) lat (ms,%): 7086.63 err/s: 0.00 reconn/s: 0.00
[ 260s ] thds: tps: 9.20 qps: 210.87 (r/w/o: 139.78/35.00/36.10) lat (ms,%): 8038.61 err/s: 0.00 reconn/s: 0.00
[ 270s ] thds: tps: 11.20 qps: 222.78 (r/w/o: 156.79/27.50/38.50) lat (ms,%): 6026.41 err/s: 0.00 reconn/s: 0.00
[ 280s ] thds: tps: 11.50 qps: 230.55 (r/w/o: 160.73/31.31/38.51) lat (ms,%): 7615.89 err/s: 0.00 reconn/s: 0.00
[ 290s ] thds: tps: 12.80 qps: 255.18 (r/w/o: 179.29/30.90/45.00) lat (ms,%): 7086.63 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: tps: 12.90 qps: 237.20 (r/w/o: 171.00/24.80/41.40) lat (ms,%): 6247.39 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read:
write:
other:
total:
transactions: (10.93 per sec.)
queries: (218.52 per sec.)
ignored errors: (0.00 per sec.)
reconnects: (0.00 per sec.) General statistics:
total time: .9413s
total number of events: Latency (ms):
min: 975.37
avg: 4575.91
max: 13565.48
95th percentile: 7479.98
sum: 15095927.24 Threads fairness:
events (avg/stddev): 65.9800/1.97
execution time (avg/stddev): 301.9185/0.01

pxc的  qtp才为11 (虚拟机,3节点在一个磁盘上)

mysql5.7 pxc的更多相关文章

  1. mysql5.7.25集群部署和方案设计(附PXC一键部署脚本)

    还记得我们之前部署mysql集群有多麻烦嘛?波哥来救你们啦!~ 我已将项目上传到了我的github仓库中,大家可以点击仓库地址出现的连接登录查看相应的代码!如果觉得不错别忘了转发.点赞哦! 部署步骤: ...

  2. MySQL高可用架构之MySQL5.7.19 PXC

    CentOS7.3下Percona-XtraDB-Cluster-5.7.19集群部署PXC三节点安装:node1:10.10.10.11 node2:10.10.10.12node3:10.10.1 ...

  3. Percona XtraDB Cluster(PXC) -集群环境安装

    Percona XtraDB Cluster(PXC)   ---服务安装篇   1.测试环境搭建: Ip 角色 OS PXC-version 172.16.40.201 Node1 Redhat/C ...

  4. MySQL集群-PXC搭建以及使用innobackupex工具进行全局备份和增量备份

    环境:centos7 vm1:10.154.47.236 vm2:10.154.52.189 vm3:10.105.12.50 目的:pxc使用三个节点构建mysql集群,使用innobackupex ...

  5. MySQL高可用之PXC安装部署

      Preface       Today,I'm gonna implement a PXC,Let's see the procedure.   Framework   Hostname IP P ...

  6. Percona-XtraDB-Cluster 5.7版本(PXC)集群部署

    PXC(Percona-XtraDB-Cluster)5.7版本集群部署 Centos 7.3系统部署Mysql 集群 PXC三个节点分别执行和安装(1)配置hosts cat /etc/hosts1 ...

  7. CENTOS 6.5 平台离线编译安装 Mysql5.6.22

    一.下载源码包 http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22.tar.gz 二.准备工作 卸载之前本机自带的MYSQL 安装 cmake,编 ...

  8. 在 Windows7 上按照 MySQL5.7

    在 Windows7 上按照 MySQL5.7 1.从官网下载最新版本的 MySQL,这里下载的是 mysql-5.7.17-win32: 2.将下载的 mysql-5.7.17-win32.zip ...

  9. Win7安装MySQL-5.7.16过程

    1.在C盘新建MYSQL文件夹:2.将mysql-5.7.16-winx64拷贝到C:\MYSQL文件夹下,更名为mysql-5.7.16:3.在mysql-5.7.16目录下,建my.ini文件,内 ...

随机推荐

  1. internet信息服务(iis)无法删除的解决方法

    internet信息服务(iis)无法删除的解决方法: 1.进入控制面板: 2.然后点击添加删除程序: 3.接着点击“添加/删除windows组件”: 4.点击“internet信息服务(iis)”, ...

  2. koa2学习笔记

    Koa -- 基于 Node.js 平台的下一代 web 开发框架 首先创建一个项目文件夹进行初始化 npm init -y 该命令执行后会生成一个package.json项目描述文件 安装koa n ...

  3. 错误 3 未找到类型“sdk:Label”。请确保不缺少程序集引用并且已生成所有引用的程序集。

    错误: 错误 3 未找到类型“sdk:Label”.请确保不缺少程序集引用并且已生成所有引用的程序集. 错误 1 命名空间“http://schemas.microsoft.com/winfx/200 ...

  4. vue 组件动态 循环

    组件可以是动态的,记录如下 <div v-for="item in arrComponent"> <component v-bind:is="item. ...

  5. MYSQL数据库安装记

    这回安装数据库装,做下记录. 1.下载mysql源安装包 shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8 ...

  6. Ubuntu中在服务器和本机之间传递文件

    首先可以通过root进入到服务器中,(登录方法在下面讲解)为自己创建一个用户. useradd的选项: 选项: -b, --base-dir BASE_DIR 新账户的主目录的基目录 -c, --co ...

  7. Docker 容器的隔离性

    Docker 容器的隔离性 就是 使用Linux namespace 来隔离运行环境和成 cgroup 限制容器使用的资源.  namespace 可以顾名思义 命名空间:所以可以理解为每个独立的容器 ...

  8. flash 概要分析器

    这个东东 调试用.会每毫秒一次记录正在运行的函数 及相关数据    只在调试版flash player才能用. startSampling  开始记录 getSamples  获取记录 Sample ...

  9. BZOJ4921「Lydsy1706月赛」互质序列

    吐槽一下BZOJ没有C++11  题还是不难的 BZOJ 4921 题意 在长度为$ n$的数列中去掉非空的连续一段并保证剩下数字不少于$ 2$ 求合法的所有方案中剩下数字的最大公约数的总和 $Sol ...

  10. vue学习之template标签

    HTML5提供的新标签,具有以下特性: 1.该元素天生display:none,同时模板元素内部内容也是隐藏的 2.位置任意,可以在<head>中,也可以在<body>或者&l ...