mysql 主从 vip_MySQL主从不同步解决

1.1、MySQL主从错误

Could not execute Update_rows event on table ezp-crm3.crm_job_stay_exec_vip; Can't find record in 'crm_job_stay_exec_vip', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000039, end_log_pos 78846

1、 show processlist,查看当前连接数,也可以看看有没有执行中的进程

2、 在从库上执行show slave status; 查看seconds_behind_maste的值,有数字表示有主从延时,这个值表示主从同步延时的时间

mysql> show slave status\G

1. row

Slave_IO_State: Waiting for master to send event

Master_Host: 10.10.225.239

Master_User: ucloudbackup

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000039

Read_Master_Log_Pos: 3642231

Relay_Log_File: mysql-relay.000146

Relay_Log_Pos: 77961

Relay_Master_Log_File: mysql-bin.000039

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: 1032

Last_Error: Could not execute Update_rows event on table ezp-crm3.crm_job_stay_exec_vip; Can't find record in 'crm_job_stay_exec_vip', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000039, end_log_pos 78846

如果未同步,在从库上执行下列操作:

stop slave;

#表示跳过一步错误,后面的数字可变

set global sql_slave_skip_counter =1;

start slave;

show slave status;

2.1、MySQL主从错误:

报错信息:Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log mysql-bin.001045, end_log_pos 454708145. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

报错是1032,没有找到要操作的记录,有时候会出这个报错,原因是开启了并行复制,先关闭并行复制 重启复制就可以了,然后再打开并行复制。

解决方法

stop slave;

set global slave_parallel_workers=0;

start slave;

恢复后,可以改回来或者保持不修改

stop slave;

set global slave_parallel_workers=8;

start slave;

你可能感兴趣的:(mysql,主从,vip)