MySQL56 GTID模式,同步复制报错不能跳过解决方法_第1页
MySQL56 GTID模式,同步复制报错不能跳过解决方法_第2页
MySQL56 GTID模式,同步复制报错不能跳过解决方法_第3页
MySQL56 GTID模式,同步复制报错不能跳过解决方法_第4页
MySQL56 GTID模式,同步复制报错不能跳过解决方法_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、MySQL5.6 GTID模式,同步复制报错不能跳过解决方法。 数据库版本:mysql select version(); TOC o 1-5 h z +| version() | +| 5.6.10-log | +1 row in set (0.02 sec) 同步复制信息: mysql show slave statusG;V * 1. row *Slave_IO_State: Waiting for master to send eventMaster_Host: 5Master_User: replMaster_Port: 3306 Connect_Retry:

2、60Master_Log_File: mysql-bin.000007 Read_Master_Log_Pos: 5036Relay_Log_File: M2-relay-bin.000008 Relay_Log_Pos: 408Relay_Master_Log_File: mysql-bin.000007 Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB:Replicate_Ignore_DB: mysqlReplicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_T

3、able:Replicate_Wild_Ignore_Table:Last_Errno: 1062Last_Error: Could not execute Write_rows event on table test.t; Duplicate entry 12 for key PRIMARY, Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the events master log mysql-bin.000007, end_log_pos 2267Skip_Counter: 0 Exec_Master_Log_Pos: 204

4、5Relay_Log_Space: 3810 Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: NULLMaster_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 1062Last

5、_SQL_Error: Could not execute Write_rows event on table test.t; Duplicate entry 12 for key PRIMARY, Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the events master log mysql-bin.000007, end_log_pos 2267Replicate_Ignore_Server_Ids:Master_Server_Id: 25Master_UUID: cf716fda-74e2-11e2-b7b7-000c

6、290a6b8fMaster_Info_File: /usr/local/mysql/data2/SQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State:Master_Retry_Count: 86400Master_Bind:Last_IO_Error_Timestamp:Last_SQL_Error_Timestamp: 130313 07:24:43Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set: cf716fda-74e2-11e2-b7b7

7、-000c290a6b8f:141-151Executed_Gtid_Set: cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-140Auto_Position: 11 row in set (0.02 sec)ERROR:No query specified 提示主键冲突,由于是测试机,于是我直接跳过, mysql set global sql_slave_skip_counter=1;ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with

8、 GTID_MODE = ON.Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction提示:由于运行在GTID模式,所以不支持sql_slave_skip_counter语法,如果你想跳过,就 必须把事务ID设置为空值。看来只能用这个方法了。mysql show global variables like %GTID%;| Variable_name| Variable_name| Value+| enforc

9、e_gtid_consistency | ON| gtid_executed| cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-140 | TOC o 1-5 h z | gtid_mode| ON| gtid_owned| gtid_purged| cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-140 |+5 rows in set (0.04 sec) mysql set global gtid_executed=;ERROR 1238 (HY000): Variable gtid_executed is a read only

10、 variable mysqlmysql set global gtid_purged=;ERROR 1840 (HY000): GTID_PURGED can only be set when GTID_EXECUTED is empty. 郁闷,直接设置还不行。查看了手册,需要执行reset master才可以(注:在从上执行啊,千万别在主上)。mysql reset master;Query OK, 0 rows affected (0.16 sec) mysql reset slave;ERROR 1198 (HY000): This operation cannot be perfo

11、rmed with a running slave; run STOP SLAVE firstmysql stop slave;Query OK, 0 rows affected (0.08 sec) mysql reset slave;Query OK, 0 rows affected (0.16 sec)执行 reset slave 的目的是清空 和 ,以便后面重新 change master to 主 从复制。还记得刚才的 gtid_purged 那个点吗,只需重新设置下一个点即可。下面是步骤:mysql show global var

12、iables like %GTID%; TOC o 1-5 h z +| Variable_name| Value |+| enforce_gtid_consistency | ON | gtid_mode| ON| gtid_owned| gtid_purged|5 rows in set (0.06 sec)TOmysql set global gtid_purged=cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-141; Query OK, 0 rows affected (0.16 sec)TOmysql CHANGE MASTERMASTER_HOST

13、=5,MASTER_USER=repl,MASTER_PASSWORD=repl ,MASTER_AUTO_POSITION = 1;Query OK, 0 rows affected, 2 warnings (0.32 sec)mysql start slave;Query OK, 0 rows affected (0.13 sec)mysql show slave statusG;V* 1. row *Slave_IO_State: Waiting for master to send event Master_Host: 5 Master_Us

14、er: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000007Read_Master_Log_Pos: 5036Relay_Log_File: M2-relay-bin.000008Relay_Log_Pos: 408Relay_Master_Log_File: mysql-bin.000007Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB:Replicate_Ignore_DB: mysqlReplicate_Do_Table:Repli

15、cate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 1050Last_Error: Error Table t0 already exists on query.Default database: test. Query: create table t0 like tSkip_Counter: 0Exec_Master_Log_Pos: 2298 Relay_Log_Space: 3557 Until_Condition: NoneUntil_Log_File:Until_Log_P

16、os: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: NULLMaster_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 1050Last_SQL_Error: Error Table t0 already exists on query.Default database: tes

17、t. Query: create table t0 like tReplicate_Ignore_Server_Ids:Master_Server_Id: 25Master_UUID: cf716fda-74e2-11e2-b7b7-000c290a6b8fMaster_Info_File: /usr/local/mysql/data2/SQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State:Master_Retry_Count: 86400Master_Bind:Last_IO_Error_Timesta

18、mp:Last_SQL_Error_Timestamp: 130313 07:50:42Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set: cf716fda-74e2-11e2-b7b7-000c290a6b8f:142-151Executed_Gtid_Set: cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-141Auto_Position: 11 row in set (0.02 sec)ERROR:No query specified# 看,这里的报错信息已经不一样了,按照这种方法,重复执行,直到同步

19、复制正常mysql stop slave;Query OK, 0 rows affected (0.07 sec) mysql reset master;Query OK, 0 rows affected (0.17 sec) mysql reset slave;Query OK, 0 rows affected (0.16 sec)mysql set global gtid_purged=cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-151;Query OK, 0 rows affected (0.13 sec)TOmysql CHANGE MASTER MA

20、STER_HOST=5,MASTER_USER=repl,MASTER_PASSWORD=repl ,MASTER_AUTO_POSITION = 1;TOQuery OK, 0 rows affected, 2 warnings (0.33 sec)mysql start slave;Query OK, 0 rows affected (0.11 sec)mysql show slave statusG;V* 1. row *Slave_IO_State: Waiting for master to send event Master_Host:

21、5 Master_User: replMaster_Port: 3306 Connect_Retry: 60Master_Log_File: mysql-bin.000007 Read_Master_Log_Pos: 5036Relay_Log_File: M2-relay-bin.000008 Relay_Log_Pos: 408Relay_Master_Log_File: mysql-bin.000007Slave_IO_Running: YesSlave_SQL_Running: Yes Replicate_Do_DB:Replicate_Ignore_DB: mysqlReplicat

22、e_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 0 Last_Error:Skip_Counter: 0Exec_Master_Log_Pos: 5036 Relay_Log_Space: 819 Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path:Master_SSL_Cert:Master_SS

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论