实际上什么被复制到 MySQL 从属服务器?
我在多主复制设置中配置了两台 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大概。
好吧,你可以解构binlog,但我希望阅读复制格式选项< /a> 不会那么令人头疼。
您可能处于基于语句的模式,这是多年来的默认模式。如果那些
INSERT INTO ... SELECT
语句很痛苦,您希望处于基于行的模式或混合模式。这些选项仅在 MySQL 5.1 或更高版本中可用。Probably.
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.运行实际的查询。 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.