MGR磁盘扩容案例
目录前言
通常LVM扩容是不需要重启数据库和主机的,但是因为添加了磁盘无法读取到盘,所以需要重启主机获取新增的磁盘。
操作流程
- 备库停止MGR组复制
stop GROUP_REPLICATION;
- 停库
mysqladmin -uroot -p'Mg#PaS5#2020' shutdown
- 重启
reboot或者init 6
- 扩盘
1.将分区创建为PV
pvcreate /dev/sdd
2.选择PV加入到VG
vgextend vgdata /dev/sdd
3.扩容LV
lvextend -l +100%FREE /dev/mapper/vgdata-lvdata /dev/sdd
4.重新调整分区大小
xfs_growfs /dev/mapper/vgdata-lvdata
6.查看扩容是否成功
df -h
5.启动数据库并启动复制
mysqld_safe --defaults-file=/etc/my.cnf &
START GROUP_REPLICATION;
- 等待复制状态正常才能操作第二个节点(需要等待MEMBER_STATE由recovering到online才能操作其他节点)
SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 2e341cba-6744-11ea-a14d-0xxxx | 10.xx.xxx.xx | 3306 | ONLINE | PRIMARY | 8.0.19 |
| group_replication_applier | 86bcf37c-1f74-11ec-8ae7-005xxx | 10.xxx.xx.xx | 3306 | ONLINE | SECONDARY | 8.0.19 |
| group_replication_applier | a25d2488-6748-11ea-832a-0xxxx | 10.xxx.xx.xx | 3306 | ONLINE | SECONDARY | 8.0.19 |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
-
第二个节点重复以上操作
-
主从切换
#获取MEMBER_ID
SELECT * FROM performance_schema.replication_group_members;
#将想要设置为主节点的MEMBER_ID填入以下查询设置中。
SELECT group_replication_set_as_primary('2e341cba-6744-11ea-a14d-005056a744d7');
- 停止MGR组复制
stop GROUP_REPLICATION;
10 . 重复添加磁盘的操作
标签:group,replication,MGR,MEMBER,案例,xx,磁盘,主从 From: https://www.cnblogs.com/xulinforDB/p/17496247.html