简体   繁体   English

MariaDB复制-由于中继日志中的gtid语句而导致的从属滞后

[英]MariaDB replication - slave lag due to gtid statements in relay log

I'm doing a migration work from MySql to MariaDB where replication is involved, everything is working fine and compatibility of master MySql (5.5.59) to slave MariaDB (10.1.26) is good. 我正在做从MySql到涉及复制的MariaDB的迁移工作,一切工作正常,并且主MySql(5.5.59)与从属MariaDB(10.1.26)的兼容性很好。

The problem occur when I enable the replication from MariaDB master to MariaDB slave (same versions: 10.1.26). 当我启用从MariaDB主服务器到MariaDB从服务器(相同版本:10.1.26)的复制时,会发生问题。 In some situations, identified on massive updates, the slave start to lag. 在某些情况下(从大量更新中发现),从站开始滞后。 If I restore the master to MySql (5.5.59) and I replicate to the same slave in MariaDB, the lag never occur on the same set of updates. 如果将主数据库还原到MySql(5.5.59),并且将其复制到MariaDB中的相同从数据库,则在同一组更新上永远不会出现延迟。

I checked the relay logs in the MariaDB slave that is lagging, comparing the ones received when MySql is the master and the ones received when MariaDB is the master, the only differences are that when the master is MariaDB I can see statements related to gtid. 我检查了滞后的MariaDB从站中的中继日志,比较了MySql作为主数据库时收到的中继日志和MariaDB是主数据库时收到的中继日志,唯一的区别是,当主数据库是MariaDB时,我可以看到与gtid相关的语句。

I would like to disable the presence of the gtid statements on the relay log when the master is MariaDB and make a replication similar to the "old style" MySql replication without gtid, but I've not found if is possible to do that. 当主服务器是MariaDB时,我想在中继日志上禁用gtid语句,并进行类似于gtid的“旧样式” MySql复制的复制,但是我找不到是否可以这样做。

The replication lag was due to the engine set in the table mysql.gtid_slave_pos in the slave server, by default this table is InnoDB and the tables that were receiving the replication updates are not InnoDB. 复制滞后是由于在从属服务器的表mysql.gtid_slave_pos中设置了引擎而导致的,默认情况下此表为InnoDB,接收复制更新的表不是InnoDB。

As explained in the link below, every transaction executed by the slave cause also an update on mysql.gtid_slave_pos, if the engines of the tables are different, that can cause a bad performance (in my case the server was lagging 4000+ seconds, changing the engine in the mysql.gtid_slave_pos the replication is now immediate). 如下面的链接所述,从服务器执行的每个事务也会导致mysql.gtid_slave_pos上的更新,如果表的引擎不同,则可能导致性能下降(在我的情况下,服务器滞后4000+秒,在mysql.gtid_slave_pos中的引擎上,复制立即生效)。

https://mariadb.com/kb/en/library/mysqlgtid_slave_pos-table/ https://mariadb.com/kb/en/library/mysqlgtid_slave_pos-table/

From MariaDB 10.3.1, a new parameter has been introduced to help with this problem: gtid_pos_auto_engines This parameter will create a different table mysql.gtid_slave_pos for each engine involved in the replication. 自MariaDB 10.3.1起,引入了一个新参数来解决此问题:gtid_pos_auto_engines此参数将为复制中涉及的每个引擎创建一个不同的表mysql.gtid_slave_pos。 Unfortunately seems not possible to accomplish that with previus version of MariaDB, the table mysql.gtid_slave_pos must be unique and the choice of its engine is up to the DBA and the tables/queries involved in the replication 不幸的是,似乎无法使用先前版本的MariaDB来完成表mysql.gtid_slave_pos的唯一性,并且其引擎的选择取决于DBA和复制所涉及的表/查询

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

相关问题 MySQL 由于删除查询 - 基于行的复制,从站中的复制滞后 - MySQL Replication lag in slave due to Delete query - Row Based Replication 从机 mysql GTID 复制上的事务不一致 - Transaction inconsistencies on slave mysql GTID replication mariadb 复制(主/从) - 由于删除查询执行时间较长,从属滞后 - mariadb replication (master / slave) - slave lagging behind due to long execution on delete query 在Galera Cluster和独立MySQL从站之间设置GTID复制 - Set up GTID replication between Galera Cluster and standalone MySQL slave MySQL复制是否不同步? 等待从属SQL线程释放足够的中继日志空间 - Is MySQL Replication out of sync? Waiting for the slave SQL thread to free enough relay log space mysql复制受等待从属SQL线程释放足够的中继日志空间影响? - Mysql replication affected with Waiting for the slave SQL thread to free enough relay log space? MariaDB 不启动 - gtid_slave_pos.ibd & 无法找到 `mysql` 的有效表空间文件。`gtid_slave_pos`` - MariaDB does not start - gtid_slave_pos.ibd & Could not find a valid tablespace file for `mysql`.`gtid_slave_pos`` mariadb:中继日志写入失败 - mariadb : Relay log write failure Mariadb 主从复制 SSL 错误 - Mariadb Master - Slave replication SSL Error MariaDB - 复制。 从站落后一个时间间隔 - MariaDB - Replication. Slave Lagging Behind For an Interval
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM