gpt4 book ai didi

mysql - MySQL中主二进制日志和从二进制日志有什么区别?如何在两台服务器上实现相同的二进制日志?

转载 作者:行者123 更新时间:2023-11-29 17:05:28 25 4
gpt4 key购买 nike

我有主服务器和从服务器。复制完成。现在我在两台服务器上都执行了以下步骤。

mysql> show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 1608 |
+------------------+-----------+

1 rows in set (0.00 sec)

mysql> flush binary logs;

mysql> show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 1608 |
| mysql-bin.000002 | 154 |
+------------------+-----------+
2 rows in set (0.00 sec)

之后我在我的 master 中运行了插入查询。 然后检查我的主二进制日志。尺寸增大。但奴隶没有任何变化。但我想在从站二进制日志中增加与主站相同的内容。 原因是我想使用二进制日志从slave进行增量备份。

最佳答案

您需要启用log-slave-updates (在 MySQL 8.0.3 之前默认禁用)以包含从主服务器接收到的更改:

Normally, a slave does not write any updates that are received from a master server to its own binary log. This option causes the slave to write the updates performed by its SQL thread to its own binary log. For this option to have any effect, the slave must also be started with the --log-bin option to enable binary logging. --log-slave-updates is used when you want to chain replication servers.

关于mysql - MySQL中主二进制日志和从二进制日志有什么区别?如何在两台服务器上实现相同的二进制日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52079372/

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