简体   繁体   English

是否可以要求ProxySQL在读取时使用特定的GTID?

[英]Can ProxySQL be asked to use a specific GTID on a read?

We have an application that issues a write to ProxySQL, followed by an immediate read that might be affected by the write. 我们有一个应用程序,它发出对ProxySQL的写操作,然后发出立即读操作,该操作可能受写操作影响。 Behind ProxySQL are four MySQL servers - one writer and three readers that replicate from the writer. ProxySQL的后面是四个MySQL服务器-一个写入器和三个从写入器复制的读取器。

Now, ProxySQL is able to ensure that it selects an 'up to date' reader by recording the GTID sent back in the OK packet from the original write and the binlog feed from the readers to ensure it picks one that has executed the write already. 现在,ProxySQL能够通过记录从原始写入的OK数据包中发回的GTID和来自读取器的binlog提要来确保它选择了一个“最新”读取器,以确保它选择了已经执行了写入的读取器。

Our problem is that, because of our topology, the read may actually reach ProxySQL on a different connection than the write. 我们的问题是,由于拓扑结构的原因,读取实际上可能通过与写入不同的连接到达ProxySQL。 It's therefore possible that the 'read' connection is holding an older GTID and hence a 'not up to date' reader might be selected upon which the write hasn't yet occurred. 因此,“读取”连接可能持有较旧的GTID,因此可能会选择尚未发生写入的“非最新”读取器。

We can see a possible solution if ProxySQL could be told to ensure the reader is up to date with a 'specified' GTID (one that we parse out of the OK packet ourselves) rather than the one on the connection, but we don't know if we can do that - I can't see anything in the documentation. 如果可以告诉ProxySQL以确保读者使用最新的“指定的” GTID(我们自己从OK数据包中解析出的GTID)而不是连接中的GTID,我们可以看到一种可能的解决方案。知道我们是否可以这样做-我在文档中什么都看不到。

Any thoughts towards a workable solution would be very much welcomed! 任何对可行解决方案的想法都将受到欢迎!

We are using mySQL 5.7.25 with ProxySQL version 2.0.3-29-g00f26d5. 我们将MySQL 5.7.25与ProxySQL 2.0.3-29-g00f26d5一起使用。

Our result currently is that we often execute the write then a read, but the read returns the state that existed before the write. 当前,我们的结果是,我们通常先执行写操作,然后执行读操作,但是读操作返回写操作之前存在的状态。

My understanding is, that proxysql supports GTID consistent out of the box - when some circumstances are fulfilled. 我的理解是,当满足某些情况时,proxysql开箱即用地支持GTID。

  1. binlog_format is ROW binlog_format是ROW
  2. on the backend session_track_gtids is set to OWN_GTID 后端session_track_gtids上的设置为OWN_GTID
  3. the monitor user of proxysql exists on the backend servers 后端服务器上存在proxysql的监视用户
  4. mysql_replication_hostgroups is also setup mysql_replication_hostgroups也已设置

It seems there isn't 'an answer' to this with ProxySQL as it stands today (2.0.3-29-g00f26d50), although the ProxySQL guys were willing to build the facility in for fee. 如今,ProxySQL(2.0.3-29-g00f26d50)似乎并没有“解决方案”,尽管ProxySQL的人愿意为此付费建立该设施。

Meanwhile, we've taken the step of using the writer (by assigning it to a group and selecting that) for reads that must be up-to-date with a previous call as it'll always hold the latest consistent view. 同时,我们已采取以下步骤:使用writer(通过将其分配给一个组并进行选择)来处理必须与上一个调用保持最新状态的读取,因为它将始终保持最新的一致视图。 This will be a performance hit, but should be acceptable if such requests are not too common. 这将对性能造成影响,但如果此类请求不太常见,则应该可以接受。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM