新节点在线加入PXC
环境
192.168.139.151 新增节点
192.168.139.148-150 集群节点
192.168.139.151 已经安装好PXC软件
计划:
选用192.168.139.150 节点先与192.168.139.151组成主从节点
再转成集群节点
构建主从环境
150 节点创建主从同步账号:
mysql>create user 'bak'@'192.168.139.%' identified by '123456';
mysql>grant replication slave on *.* to 'bak'@'192.168.139.%';
mysql>flush privileges;
150数据拷贝至151上
#mysqldump --single-transaction -uroot -p123456 -A --master-data=2 > all.sql
#scp all.sql root@192.168.139.151:/opt/
151上恢复数据
mysql>SET GLOBAL pxc_strict_mode=PERMISSIVE;
#mysql -u root -p123456 < all.sql
151配置主从同步
#####master_log 信息可在150 使用flsuh logs ; show master status查看
change master to master_host='192.168.139.150',master_user='bak',master_password='123456',master_log_file='pxc-bin.000001',master_log_pos=928;
151开启同步
start slave;
show slave status\G;
151配置集群
systemctl stop mysql
vim /etc/my.cnf ===>注意文件下面的include ,配置文件可能在指定路径中,my.cnf只是类似于软链
server-id=4 #与集群中其他的节点不一样
# Path to Galera library
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
#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://192.168.139.148,192.168.139.149,192.168.139.150,192.168.139.151
binlog_format=ROW
default_storage_engine=InnoDB
wsrep_slave_threads= 8
innodb_autoinc_lock_mode=2
wsrep_node_address=192.168.139.151
# Cluster name
wsrep_cluster_name=pxc-cluster
wsrep_node_name=pxc-cluster-node-4
pxc_strict_mode=ENFORCING
wsrep_sst_method=xtrabackup-v2
srep_sst_auth="sstuser:passw0rd"
150检查PXC需要同步位置
mysqlbinlog -v -v mysql-bin.000001 | grep Xid ===》找到position 对应的,没有 就在MySQL中的表随便插入什么东西,执行commit ,在查询
scp /var/lib/mysql/grastate.dat root@192.168.139.151:/var/lib/mysql/
151编辑文件
151查看测试结果:
最新文章
- PHP 对象 “==” 与 “===”
- 使用DBMS_STATS来收集统计信息【转】
- URAL1900 Brainwashing Device(dp)
- [课程相关]homework-08
- 解析JavaScript中apply和call以及bind
- nginx : TCP代理和负载均衡的stream模块
- Matlab图像处理系列2———空间域平滑滤波器
- CSS入门介绍
- 解读Scrum燃尽图
- PHP UEditor富文本编辑器 显示 后端配置项没有正常加载,上传插件不能正常使用
- Python学习(三十二)—— Django之视图系统
- 64位平台C/C++容易犯的错误
- 一个Fragment的实例
- 用PowerShell激活anaconda的环境
- zabbix 监控Nginx和PHP
- SQL 经典回顾:JOIN 表连接操作不完全指南
- Charles应用指南--安装与代理篇
- Wifi NAT Driver
- utsrelease.h 包含svn信息
- Python 3 操作json 文件
热门文章
- Django:视图views(一)
- wslgit
- XPC connection interrupted
- iOS 问答时间
- 于dm-0 dm-1
- 分布式锁 AP需求 CP需求
- mysql设置指定ip访问,用户权限相关操作
- scrapy windows下出现importError:No module named &#39;win32api&#39;
- 洛谷 P3684 机棚障碍Hangar Hurdles [CERC2016] 图论
- Maven项目Update Project后JRE System Library自动变回1.5解决办法