mysql5.6关闭不了gtid模式_MySQL5.6 GTID模式 同步复制跳过报错解决方法

1.mysql slave 报错

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State:

Master_Host: 172.17.0.7

Master_User: rep

Master_Port: 33066

Connect_Retry: 60

Master_Log_File: mysql-bin_33066.000130

Read_Master_Log_Pos: 480808141

Relay_Log_File: iZ256aoo65wZ-relay-bin.000023

Relay_Log_Pos: 730067652

Relay_Master_Log_File: mysql-bin_33066.000114

Slave_IO_Running: No

Slave_SQL_Running: No

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 1062

Last_Error: Could not execute Write_rows event on table bvcs_statistics.log_give; Duplicate entry '1060' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin_33066.000114, end_log_pos 730069351

Skip_Counter: 0

Exec_Master_Log_Pos: 730067430

Relay_Log_Space: 17670689507

Until_Condition: None

Until_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: NULL

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 1062

Last_SQL_Error: Could not execute Write_rows event on table bvcs_statistics.log_give; Duplicate entry '1060' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin_33066.000114, end_log_pos 730069351

Replicate_Ignore_Server_Ids:

Master_Server_Id: 1

Master_UUID: b6eb5dbc-62b6-11e6-968d-00163e033d3e

Master_Info_File: /u01/mysql/data/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State:

Master_Retry_Count: 86400

Master_Bind:

Last_IO_Error_Timestamp:

Last_SQL_Error_Timestamp: 160825 17:45:09

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set: b6eb5dbc-62b6-11e6-968d-00163e033d3e:1-27738

Executed_Gtid_Set: 74b85d01-63a5-11e6-9ca2-00163e033f0b:1-3,

b6eb5dbc-62b6-11e6-968d-00163e033d3e:1-8470

Auto_Position: 1

1 row in set (0.00 sec)

2.用老方法解决,不行

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 @@GLOBAL.GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction

3.用新方法解决

mysql> show global variables like '%gtid%';

+--------------------------+---------------------------------------------------------------------------------------+

| Variable_name            | Value                                                                                 |

+--------------------------+---------------------------------------------------------------------------------------+

| enforce_gtid_consistency | ON                                                                                    |

| gtid_executed            | cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-140 |

| gtid_mode                | ON                                                                                    |

| gtid_owned               |                                                                                       |

| gtid_purged              | cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-140 |

+--------------------------+---------------------------------------------------------------------------------------+

5 rows in set (0.00 sec)

mysql> reset master;

Query OK, 0 rows affected, 1 warning (0.65 sec)

mysql> stop slave;

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  reset slave;

Query OK, 0 rows affected (1.03 sec)

mysql> set global gtid_purged='cf716fda-74e2-11e2-b7b7-000c290a6b8f:1-141';  #注意这里加1

Query OK, 0 rows affected (0.16 sec)

mysql> change master to master_host='172.17.0.7',master_port=33066,master_user='rep',master_password='rep',master_auto_position=1;

mysql> start slave;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值