mysql5.7 pxc
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的更多相关文章
- mysql5.7.25集群部署和方案设计(附PXC一键部署脚本)
还记得我们之前部署mysql集群有多麻烦嘛?波哥来救你们啦!~ 我已将项目上传到了我的github仓库中,大家可以点击仓库地址出现的连接登录查看相应的代码!如果觉得不错别忘了转发.点赞哦! 部署步骤: ...
- 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 ...
- Percona XtraDB Cluster(PXC) -集群环境安装
Percona XtraDB Cluster(PXC) ---服务安装篇 1.测试环境搭建: Ip 角色 OS PXC-version 172.16.40.201 Node1 Redhat/C ...
- MySQL集群-PXC搭建以及使用innobackupex工具进行全局备份和增量备份
环境:centos7 vm1:10.154.47.236 vm2:10.154.52.189 vm3:10.105.12.50 目的:pxc使用三个节点构建mysql集群,使用innobackupex ...
- MySQL高可用之PXC安装部署
Preface Today,I'm gonna implement a PXC,Let's see the procedure. Framework Hostname IP P ...
- Percona-XtraDB-Cluster 5.7版本(PXC)集群部署
PXC(Percona-XtraDB-Cluster)5.7版本集群部署 Centos 7.3系统部署Mysql 集群 PXC三个节点分别执行和安装(1)配置hosts cat /etc/hosts1 ...
- CENTOS 6.5 平台离线编译安装 Mysql5.6.22
一.下载源码包 http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22.tar.gz 二.准备工作 卸载之前本机自带的MYSQL 安装 cmake,编 ...
- 在 Windows7 上按照 MySQL5.7
在 Windows7 上按照 MySQL5.7 1.从官网下载最新版本的 MySQL,这里下载的是 mysql-5.7.17-win32: 2.将下载的 mysql-5.7.17-win32.zip ...
- 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文件,内 ...
随机推荐
- Spark SQL基本概念与基本用法
1. Spark SQL概述 1.1 什么是Spark SQL Spark SQL是Spark用来处理结构化数据的一个模块,它提供了两个编程抽象分别叫做DataFrame和DataSet,它们用于作为 ...
- mongoDB与mongoose
mongodb是一个基于分布式文件存储的文档型数据库 MongoDB 是一个介于关系数据库和非关系数据库之间的产品 MongoDB 最大的特点是他支持的查询语言非常强大,而且还支持对数据建立索引 官方 ...
- 二叉树的python可视化和常用操作代码
二叉树是一个重要的数据结构, 本文基于"二叉查找树"的python可视化 pybst 包, 做了一些改造, 可以支持更一般的"二叉树"可视化. 关于二叉树和二叉 ...
- Win10 64位连接LJM1005打印机局域网访问
除了网上常见的开Guest用户之类需要额外三个设置 (1)安装LJM1005驱动LJM1005_Full_Solution (2)设置打印机共享和安全中的everyone全部勾选(解决能看到打印机无法 ...
- mac怎么快速回到桌面 隐藏所有窗口
当你同时按下Option+Command+h键,就能把所有已打开的程序窗口(不包括当前正在运行的应用程序窗口)最小化到Dock栏上.注意不是关闭哦,是最小化哦.如果需要把程序窗口恢复到屏幕上,直接点击 ...
- 【Vue课堂】Vue.js 父子组件之间通信的十种方式
这篇文章介绍了Vue.js 父子组件之间通信的十种方式,不管是初学者还是已经在用 Vue 的开发者都会有所收获.无可否认,现在无论大厂还是小厂都已经用上了 Vue.js 框架,简单易上手不说,教程详尽 ...
- Jenkins和pipeline
Jenkins https://jenkins.io/index.html The leading open source automation server, Jenkins provides hu ...
- EL11个内置对象
EL是JSP内置的表达式语言 JSP2.0开始,让再使用Java脚本,而是使用EL表达式和动态标签来代替Java脚本 EL替代的是<%=... %>,也就是说EL只能做输出 EL可以输出的 ...
- luogu 3045 优先队列反悔/bzoj 2590
N头奶牛,价格Pi,K张优惠券,优惠券购买降为Ci,不超过M的钱最多可买多少奶牛 先将c值k小的加入,将它们省下的钱加入优先队列(省下的钱由少到多),在将k+1-n用p排序,再逐个与优先队列中弹出的比 ...
- JavaScript面试技巧(一):基础知识
1.变量类型和计算 变量类型:值类型.引用类型.typeof运算符. 变量计算:字符串拼接.==运算符.if语句.逻辑运算符 2.原型和原型链 构造函数 5个原型规则 3.作用域和闭包-执行上下文 4 ...