MySQL MMM 数据不一致探究(2)

从上面的代码可以看出,在以下的架构中,只要是 主2和slave n出现延迟,在自动failover后就可能会造成主2和slave n的数据不一致现象
主1  ----slave1,slave2
主2


如果仅仅是双主的架构,主1的实例down,自动failover后,可能会丢失部分数据。在线切换的话,不会丢失数据。


Flapping问题也可能会使数据出现问题,下面是官方文档中对Flapping的解释:
mmm mond supports the detection of hosts that are "flapping". Flapping occurs if a host
which is ONLINE changes its state to HARD_OFFLINE / REPLICATION_FAIL / REPLICATION_
DELAY too often and each time gets switched back to ONLINE (because of auto set online or
because it has been down for less than 60 seconds). This may lead to roles getting switched
between hosts very often.
To prevent this mmm mond has a built in flap-detection which can be tuned in the
configuration file. If a host goes down for more than flap count times within flap duration
seconds it is considered as flapping and will not be set ONLINE automatically. It will stay in
state AWAITING_RECOVERY until it gets set online (with mmm_control set_online host ).
If auto set online is > 0, flapping hosts will automatically be set to ONLINE after
flap duration seconds.


要解决Flapping问题,我们可以设置master-connect-retry参数,但是官方2.2.1版本中设置这个参数是无效的,官方的代码:
# set ONLINE because of small downtime
if ($agent->last_uptime > 0 && $uptime_diff > 0 && $uptime_diff < 60) {
    FATAL sprintf("State of host '%s' changed from %s to ONLINE because it was down for only %d seconds", $host, $state, $uptime_diff);
    $agent->state('ONLINE');
    $self->send_agent_status($host);
    next;
}

把60改为0.0001,这样就防止了原master online,我们处理完原master后,再手动执行set_online命令。

使用MySQL-MMM实现MySQL集群部署 

MySQL MMM架构看不到vip地址 

MySQL的MMM高可用架构测试

MySQL-MMM实现MySQL高可用

MySQL-MMM切换演示

mysql proxy、MySQL-MMM实现读写分离高可用性

将MySQL-MMM Master从REPLICATION_FAIL状态恢复

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/35fe1cc1a633c3103ffc51f49febd832.html