mha mysql 中国用的多吗_MHA 多VIP 多MySQL实例的支持

MHA 多VIP 多MySQL实例的支持

首先看power_manager 脚本

MHA Manager如果能够SSH到Master主机,会调用stopssh方法,stopssh方法根据master_pid_file来远程kill MySQL实例的进程,不管是 kill 成功还是失败,最后都要返回10,

至于kill掉所有mysql instance的代码直接去掉。

MHA Manager如果不能够SSH到Master主机,会调用stop方法,由于是MySQL多实例,stop方法就一定不能 shutdown Master主机,不管你怎样扩展stop方法,最后都要返回0,来告诉MHA Manager 启动failover。

这样 power_manager脚本仅用来kill MySQL实例。

扩展参数配置文件的[server default]部分,添加以下两个参数,以告诉MHA Manager来管理MySQL实例的vip.

master_vip_interface=eth0:2

master_vip=192.168.23.88

在下面这三个源文件中添加master_vip_interface 和 master_vip的参数项目内容:

Config.pm

MasterMonitor.pm

MasterFailover.pm

对于 master_ip_failover脚本,我们同样添加这两个参数,然后在stopssh 中远程shutdown vip,在start中 startup vip。

在自动failover的时候,master_ip_failover脚本的调用都会附加 master_vip_interface 和 master_vip 两个参数:--check status Phase

Fri Jan  9 14:46:53 2015 - [info] Checking master_ip_failover_script status:

Fri Jan  9 14:46:53 2015 - [info]   /script/mha/master_ip_failover --command=status --ssh_user=root --orig_master_host=mha1 --orig_master_ip=192.168.23.64 --orig_master_port=3306 --master_vip=192.168.23.88 --master_vip_interface=eth0:2

--stop or stopssh Phase 卸载VIP

Fri Jan  9 14:48:41 2015 - [info] Forcing shutdown so that applications never connect to the current master..

Fri Jan  9 14:48:41 2015 - [info] Executing master IP deactivation script:

Fri Jan  9 14:48:41 2015 - [info]   /script/mha/master_ip_failover --orig_master_host=mha1 --orig_master_ip=192.168.23.64 --orig_master_port=3306 --master_vip=192.168.23.88  --master_vip_interface=eth0:2 --command=stopssh --ssh_user=root

Fri Jan  9 16:14:55 2015 - [info] Forcing shutdown so that applications never connect to the current master..

Fri Jan  9 16:14:55 2015 - [info] Executing master IP deactivation script:

Fri Jan  9 16:14:55 2015 - [info]   /script/mha/master_ip_failover --orig_master_host=mha1 --orig_master_ip=192.168.23.64 --orig_master_port=3306 --master_vip=192.168.23.88  --master_vip_interface=eth0:2 --command=stop

--start Phase 添加VIP

Fri Jan  9 14:48:44 2015 - [info] Executing master IP activate script:

Fri Jan  9 14:48:44 2015 - [info]   /script/mha/master_ip_failover --command=start --ssh_user=root --orig_master_host=mha1 --orig_master_ip=192.168.23.64 --orig_master_port=3306 --new_master_host=mha2 --new_master_ip=192.168.23.66 --new_master_port=3306 --new_master_user='root' --new_master_password='123QWE3306' --master_vip=192.168.23.88  --master_vip_interface=eth0:2

Set read_only=0 on the new master.

Enabling the VIP - 192.168.23.88 on the new master - mha2:eth0:2.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值