mysql last error_mysql主从同步报错,提示Last_Error: Coordinator stopped because there were error(s) in the wo...

原因:

因调整服务器架构,需加多一台数据库从库,在同步时提示主键错误.

mysql> show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 10.130.69.23

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: master-bin.005600

Read_Master_Log_Pos: 12635460

Relay_Log_File: SL-sasha-db-3-relay-bin.000002

Relay_Log_Pos: 1120

Relay_Master_Log_File: master-bin.005599

Slave_IO_Running: Yes

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: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '1fbad120-2835-11e8-964c-7e2eab976d2f:1323355863' at master log master-bin.005599, end_log_pos 2297. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

Skip_Counter: 0

Exec_Master_Log_Pos: 961

Relay_Log_Space: 281080188

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: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '1fbad120-2835-11e8-964c-7e2eab976d2f:1323355863' at master log master-bin.005599, end_log_pos 2297. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

Replicate_Ignore_Server_Ids:

Master_Server_Id: 1

Master_UUID: 1fbad120-2835-11e8-964c-7e2eab976d2f

Master_Info_File: mysql.slave_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: 191008 10:05:35

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set: 1fbad120-2835-11e8-964c-7e2eab976d2f:1323355859-1323817955

Executed_Gtid_Set: 1fbad120-2835-11e8-964c-7e2eab976d2f:1-1323355862

Auto_Position: 1

Replicate_Rewrite_DB:

Channel_Name:

Master_TLS_Version:

1 row in set (0.00 sec)

按照从库的提示查找原因

说明:有时会提示insert  delect 这些操作的错误,那么就需要核对主库 和从库 是否存在某条数据,核对没问题方可加入slave_skip_errors = 1062

mysql> select * from performance_schema.replication_applier_status_by_worker\G

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect...

Connection id: 37

Current database: *** NONE ***

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

CHANNEL_NAME:

WORKER_ID: 1

THREAD_ID: 27

SERVICE_STATE: ON

LAST_SEEN_TRANSACTION: 1fbad120-2835-11e8-964c-7e2eab976d2f:1323840210

LAST_ERROR_NUMBER: 0

LAST_ERROR_MESSAGE:

LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

*************************** 2. row ***************************

CHANNEL_NAME:

WORKER_ID: 2

THREAD_ID: 28

SERVICE_STATE: ON

LAST_SEEN_TRANSACTION: 1fbad120-2835-11e8-964c-7e2eab976d2f:1323840086

LAST_ERROR_NUMBER: 0

LAST_ERROR_MESSAGE:

LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

*************************** 3. row ***************************

CHANNEL_NAME:

WORKER_ID: 3

THREAD_ID: 29

SERVICE_STATE: ON

LAST_SEEN_TRANSACTION: 1fbad120-2835-11e8-964c-7e2eab976d2f:1323839341

LAST_ERROR_NUMBER: 0

LAST_ERROR_MESSAGE:

LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

*************************** 4. row ***************************

CHANNEL_NAME:

WORKER_ID: 4

THREAD_ID: 30

SERVICE_STATE: ON

LAST_SEEN_TRANSACTION: 1fbad120-2835-11e8-964c-7e2eab976d2f:1323832891

LAST_ERROR_NUMBER: 0

LAST_ERROR_MESSAGE:

LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

解决:

$ vim /etc/my.cnf

加入:

slave_skip_errors = 1062

#重启生效

$ service mysqld restart

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值