mysql 迁移3

2022-03-22 11:52:35 浏览数 (2)

关闭原集群mha

由于集群软件在侦测到主服务器失效后会干预相关资源,造成备机身份切换和IP飘移,为了避免这种影响,要关掉集群

代码语言:javascript复制
[mysql@slave02 bin]$ masterha_check_status --conf=/etc/app1.cnf
app1 (pid:18911) is running(0:PING_OK), master:origin-master
[mysql@slave02 bin]$ masterha_stop --conf=/etc/app1.cnf
Stopped app1 successfully.
[mysql@slave02 bin]$ masterha_check_status --conf=/etc/app1.cnf
app1 is stopped(2:NOT_RUNNING).
[mysql@slave02 bin]$ ps faux | grep manager
mysql    27192  0.0  0.0 103244   864 pts/2    S    00:23   0:00                                  _ grep manager
[mysql@slave02 bin]$

关闭原slave上keepalived

此目的是为了减少三个keepalived之间协商优先级的时间

代码语言:javascript复制
[root@slave01 tmp]# ps faux | grep keep 
root     25745  0.0  0.0 103244   864 pts/0    S    00:25   0:00                          _ grep keep
root     17798  0.0  0.0 110196   432 ?        Ss   Aug12  12:49 /usr/sbin/keepalived -D
root     17799  0.0  0.0 112300  1564 ?        S    Aug12  13:18  _ /usr/sbin/keepalived -D
root     17800  0.0  0.0 112300  1036 ?        S    Aug12  88:32  _ /usr/sbin/keepalived -D
[root@slave01 tmp]# ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:93:7c:78 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.123/24 brd 192.168.66.255 scope global eth0
    inet6 fe80::250:56ff:fe93:7c78/64 scope link 
       valid_lft forever preferred_lft forever
[root@slave01 tmp]# cat /etc/keepalived/keepalived.conf 
! Configuration File for keepalived

global_defs {
   router_id LVS_slave01
}

vrrp_instance VI_3 {
    state MASTER 
    interface eth0
    virtual_router_id 3
    priority 85 
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
	192.168.66.6/24
    }
}
[root@slave01 tmp]# /etc/init.d/keepalived stop 
Stopping keepalived:                                       [  OK  ]
[root@slave01 tmp]# ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:93:7c:78 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.123/24 brd 192.168.66.255 scope global eth0
    inet6 fe80::250:56ff:fe93:7c78/64 scope link 
       valid_lft forever preferred_lft forever
[root@slave01 tmp]# ps faux |  grep keep 
root     28544  0.0  0.0 103244   864 pts/0    S    00:28   0:00                          _ grep keep
[root@slave01 tmp]# 

再次检查,确认备份数据

这是最后一次备份原数据的机会

0 人点赞