ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码
当前位置:首页 >> 数据库 >> MySql >> mysql GTID主从复制 跳过复制错误

mysql GTID主从复制 跳过复制错误

来源:网络整理     时间:2016-08-24     关键词:

本篇文章主要介绍了" mysql GTID主从复制 跳过复制错误",主要涉及到方面的内容,对于MySql感兴趣的同学可以参考一下: 在mysqlGTID下,使用SETGLOBAL SQL_SLAVE_SKIP_COUNTER = n会产生如下错误ERROR 1858 (HY000): sql...

在mysqlGTID下,使用

SETGLOBAL SQL_SLAVE_SKIP_COUNTER = n

会产生如下错误

ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server isrunningwith @@GLOBAL.GTID_MODE = ON. Instead, for each transactionthat you want to skip, generate an empty transactionwiththe same GTID asthetransaction

根据报错提示,我们可以看到我们可以通过执行空事务来跳过复制错误

STOP SLAVE;
SET GTID_NEXT="7d72f9b4-8577-11e2-a3d7-080027635ef5:5";BEGIN;COMMIT;SET GTID_NEXT="AUTOMATIC";START SLAVE;

但是当需要跳过的事务较多时,这个方法比较麻烦。可以使用MySQL Utilities中的mysqlslavetrx跳过错误
mysqlslavetrx使用说明

mysqlslavetrx --gtid-set=87fd24be-683d-11e6-ba97-1418774c98d8:3-40 --slaves=root:beijing@localhost:/home/mysql/my3306.sock

参数说明:

--dryrunExecute the utility in dry-run mode, show the transactions (GTID) that would have been skipped for each slave butwithout effectively skipping them. This option is useful to verify ifthe correct transactions will be skipped.

 --gtid-set=Set of Global Transaction Identifiers (GTID) to skip.

 --helpDisplay a help message andexit.

 --licenseDisplay license information andexit.

 --slaves=Connection information for slave servers. List multiple slaves in comma-separated list.

To connect to a server, itis necessary to specify connection parameters such asthe user name, host name, password, and either a port or socket. MySQL Utilities provides a numberof ways to supply this information. All ofthe methods require specifying your choice via a command-line option such as--server, --master, --slave, etc. The methods include the following in order of most secure to least secure.Use login-paths from your .mylogin.cnf file (encrypted, not visible). Example : [:][:]

Use a configuration file (unencrypted, not visible) Note: available in release-1.5.0. Example : <>file-path>[:
] Specify the data onthe command-line (unencrypted, visible). Example : [:]@[:][:] --ssl-caThe path to a filethatcontains a listof trusted SSL CAs. --ssl-certThe nameofthe SSL certificate fileto use for establishing a secure connection. --ssl-keyThe nameofthe SSL key fileto use for establishing a secure connection. --sslSpecifies ifthe server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. Default setting is0 (SSL not required). --verbose, -vSpecify how much information to display. Use this option multiple timesto increase the amount of information. For example, -v = verbose, -vv = more verbose, -vvv = debug. --versionDisplay version information andexit.

也可以通过

setglobal gtid_purged='887fd24be-683d-11e6-ba97-1418774c98d8:3-40';

跳过已经purge的部分,之后重新开启复制即可。
完成这些操作后,如果对数据一致性的问题有顾虑,可以通过 pt-table-checksum来进行一致性检查。

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了 mysql GTID主从复制 跳过复制错误,包括了方面的内容,希望对MySql有兴趣的朋友有所帮助。

    本文网址链接:http://www.codes51.com/article/detail_3563066.html

    相关图片

    相关文章