实际上什么被复制到 MySQL 从属服务器?

发布于 2024-10-21 21:30:19 字数 386 浏览 8 评论 0原文

我在多主复制设置中配置了两台 MySQL 服务器。每个人都是对方的奴隶和主人。我的应用程序要求在后台运行一些大型查询,并且这些查询的结果将用于填充表。我想,我可以让这些大型查询在一台服务器上运行,而应用程序前端使用另一台服务器。这样,当服务器运行这些查询时,应用程序不会变慢。

这些查询非常大INSERT .... SELECT。通过我的复制设置,似乎当一台服务器完成查询时,它不只是将 INSERT 发送到从服务器,而是让从服务器运行原始的大型 INSERT/SELECT。

这真的发生了吗?或者有没有办法查看从主机向从机发送了哪些命令来验证这是行为?我能判断的唯一方法是 CPU 负载。

有没有办法让从站只能从主站上运行的 INSERT...SELECT 获取结果 INSERT?

I have two MySQL servers configured in a multi-master replication setup. Each is a slave and master to the other. My application requires that some large queries be ran in the background, and the results of these queries would be used to populate a table. I figured, I could have these large queries run on one server, and the application front-end use the other. This way, the application wouldn't be slowed while the server is running these queries.

These queries are very large INSERT .... SELECT. With my replication setup, it seems that when one server finishes the query, instead of just sending the INSERTs to the slave, it has the slave run the original large INSERT/SELECT.

Is this actually happening? Or is there a way to see what commands were sent to the slave from the master to verify this is the behavior? The only way I can tell is from CPU load.

Is there a way for the slave to only get the resulting INSERT from an INSERT... SELECT ran on the master?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鼻尖触碰 2024-10-28 21:30:19

这真的发生了吗?

大概。

或者有没有办法查看从主机向从机发送了哪些命令来验证这是行为?

好吧,你可以解构binlog,但我希望阅读复制格式选项< /a> 不会那么令人头疼。

您可能处于基于语句的模式,这是多年来的默认模式。如果那些 INSERT INTO ... SELECT 语句很痛苦,您希望处于基于行的模式混合模式。这些选项仅在 MySQL 5.1 或更高版本中可用。

Is this actually happening?

Probably.

Or is there a way to see what commands were sent to the slave from the master to verify this is the behavior?

Well, you could deconstruct the binlog, but I expect that reading up on replication format options will be much less headache-inducing.

You're probably in statement-based mode which has been the default for ages. You want to be in row-based mode or hybrid mode, if those INSERT INTO ... SELECT statements are a pain. These options are available only in MySQL 5.1 or better.

撩人痒 2024-10-28 21:30:19

运行实际的查询。 INSERT...SELECT 周围的唯一方法就是自己分解它们。运行选择,将结果存储在内存中,然后进行批量插入。

The actual queries are run. The only way around you INSERT...SELECT is to break them up yourself. Run the select, store the result in memory, then do a bulk insert.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文