简体   繁体   English

MySQL复制SLAVE下降

[英]Mysql Replication SLAVE go down

I have a problem with mysql replication. 我对mysql复制有问题。

I configure two virtual host. 我配置两个虚拟主机。

Server 1 Apache + mysql Ver 15.1 Distrib 5.5.41-MariaDB 服务器1 Apache + mysql Ver 15.1 Distrib 5.5.41-MariaDB

Master and SLAVE OF Server2 主从服务器2

Server 2 mysql Ver 14.14 Distrib 5.5.42 服务器2 mysql Ver 14.14 Distrib 5.5.42

Master and SLAVE OF Server1 主从服务器

Topologi MASTER + MASTER Topologi MASTER + MASTER

When I restart slaves all work good, short latency and fast update. 当我重新启动从站时,所有的工作正常,延迟短,更新快。 But when I wait a few minutes the replication not work more. 但是,当我等待几分钟时,复制将无法正常工作。 If I update some row or make a insert or delete the slave not update the changes. 如果我更新某行或插入或删除从属,则不会更新更改。

The logs not write any error, but the master_position_log is diferent between master and slave. 日志没有写入任何错误,但是master_position_log在主服务器和从服务器之间是不同的。

And if I restart the slaves all works again, the bdd is updated and the replication works well. 而且,如果我重新启动从属服务器,所有这些都可以再次工作,那么bdd将被更新并且复制工作正常。

I don't know what happen, seems the threads sleep or death. 我不知道会发生什么,似乎线程在睡觉或死亡。

Thanks for some idea for fix the problem 感谢您提供一些解决问题的想法

In two cases the processes seems ok. 在两种情况下,该过程似乎还可以。

SERVER1 服务器1

Kill 168 system user None Connect 1146 Waiting for master to send event --- 杀死168个系统用户无连接1146等待主机发送事件-

Kill 169 system user None Connect 945 Slave has read all relay log; Kill 169系统用户无Connect 945 Slave已读取所有中继日志; waiting for the slave I/O thread to update it --- 等待从属I / O线程更新它-

Kill 170 master XXXXXXX:59273 None Binlog Dump 1145 Master has sent all binlog to slave; 杀死170个主机XXXXXXX:59273无Binlog转储1145主机已将所有Binlog发送给从机; waiting for binlog to be updated --- 等待二进制日志被更新-

SERVER2 服务器2

Kill 73 root XXXXXX:55089 None Binlog Dump 1137 Master has sent all binlog to slave; 杀死73个根XXXXXX:55089无Binlog转储1137主服务器已将所有Binlog发送给从服务器; waiting for binlog to be updated --- 等待二进制日志被更新-

Kill 76 system user None Connect 1137 Waiting for master to send event --- 杀死76个系统用户无连接1137等待主机发送事件-

Kill 77 system user None Connect 985 Slave has read all relay log; 杀死77个系统用户无连接985从属已读取所有中继日志; waiting for the slave I/O thread to update it --- 等待从属I / O线程更新它-

The problem is latency. 问题是延迟。

My solution, create a CRON every minut for stop and start slave. 我的解决方案是,为停止和启动从站的每分钟创建一个CRON。

Now all works. 现在所有的作品。

Cristian 克里斯蒂安

SHOW SLAVE STATUS;

on each server. 在每个服务器上。 That is likely to tell you what is wrong. 那很可能会告诉你什么地方出了问题。

You do understand the potential problems with AUTO_INCREMENT and UNIQUE keys when you are writing to both heads of a dual-Master topology? 明白与潜在问题AUTO_INCREMENTUNIQUE键,当你写一个双主拓扑的两个头?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM