大网数据广告活动
服务器运维问答

MySQL package upgrades (Debian apt-get) always break master-master replication due to changes in mysql schema

· 52CE 我爱测

I have master-master replication set up on 2 Debian servers, and they replicate everything, including the mysql database itself (so that new users and such also replicate). This generally works very well, except that most, if not…

问题原文

原帖链接 · dlo · CC BY-SA 3.0

I have master-master replication set up on 2 Debian servers, and they replicate everything, including the mysql database itself (so that new users and such also replicate). This generally works very well, except that most, if not all, apt upgrades to mysql involve some changes to the mysql database schema, which cause replication errors that halt replication. Ultimately, I always need to manually fix by skipping the errant statements on each side. This is always time-consuming, and I worry I could make mistakes doing it manually (skipping too many statements, mistyping CHANGE MASTER details, etc.).

Is there something I can do to make sure that apt-get updates to MySQL in the future will get processed smoothly without causing replication problems? Surely there's a well-established best practice for this?

已采纳解答

原帖链接 · dlo · CC BY-SA 3.0

I don't know if it will work for every possible upgrade scenario, but I just tested this, and the upgrade worked without any replication problems:

# /etc/mysql/conf.d/binlog_ignoredb_mysql.cnf.disabled
# Rename this to end in .cnf prior to performing `apt-get upgrade`.
# Otherwise, its attempts to `ALTER TABLE users` will cause replication errors.
# After upgrade is complete, rename back to .disabled and then /etc/init.d/mysql restart

[mysqld]
binlog-ignore-db=mysql

Note that my test was on a minor upgrade (5.5.41 to 5.5.43).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-04-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。