gpt4 book ai didi

mysql - 将 MySQL 从属移动到新硬盘 - 我需要 mysqld-relay-bin 日志吗?

转载 作者:行者123 更新时间:2023-11-29 04:52:51 28 4
gpt4 key购买 nike

我正在将一个 MySQL 从服务器从一组 HD 移动到另一组。机器的配置使我无法同时在其上安装新旧硬盘。所以我将数据目录 rsync 到另一台机器。

当新硬盘上线时,我将数据目录重新同步。这很好用。

但是,我无法开始复制。这是我得到的错误。

120314  4:23:07 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=mysqld-relay-bin' to avoid this problem.
120314 4:23:07 [ERROR] Failed to open the relay log '/var/lib/mysqllogs/mysqld-relay-bin.000273' (relay_log_pos 677043943)
120314 4:23:07 [ERROR] Could not find target log during relay log initialization
120314 4:23:07 [ERROR] Failed to initialize the master info structure

我找到了这条评论: https://serverfault.com/questions/61471/moving-a-mysql-slave-to-a-new-host-failed-to-open-the-relay-log

If it is just complaining about the relay logs, in most cases, they are disposable if the master still has the binary logs around. You can just run CHANGE MASTER TO on the slave and it will flush the existing relay logs and start anew. You don't need to make a new fresh copy.

这似乎表明我不需要这些日志文件。

主机名没有改变。

我的问题:

我需要这些日志文件吗?

如果没有,我需要做什么才能开始复制?它会记住它停止的地方吗?

如果我确实需要这些日志文件,还有什么我忘记的吗?

最佳答案

我不认为你需要中继 bin loge 文件来让它工作。它可能记得它停止的地方,你尝试过命令 mysql>RESET SLAVE; 吗?您应该通过 SHOW SLAVE STATUS 从 SLAVE 获取位置;查看是否仍然存在,然后检查主服务器上的日志文件是否仍然存在,因为它只会在您设置最大文件大小时保留它。但是试试 RESET SLAVE;如果你没有,它会产生魔力。您可能不得不在锁定表并执行“SHOW MASTER STATUS”后立即转储现有服务器数据来重新开始整个过程​​,如果您这样做,我不建议您尝试保存此过程可以选择从头开始复制。

关于mysql - 将 MySQL 从属移动到新硬盘 - 我需要 mysqld-relay-bin 日志吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9711551/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com