生产库的主从复制报错,如何小心翼翼地一步步解决呢?

mysqldbd 2011-08-12 09:28:55
110812 09:17:07 mysqld_safe mysqld from pid file /usr/local/mysql/var/sh-192-168-250-40.chinascopefinancial.com.pid ended
110812 09:18:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
110812 9:18:54 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
110812 9:18:54 [Note] Plugin 'FEDERATED' is disabled.
110812 9:18:54 [Note] Plugin 'ndbcluster' is disabled.
110812 9:18:54 InnoDB: Started; log sequence number 0 533427566
110812 9:18:54 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000713' at position 1017000578, relay log './relay-bin.000584' position: 251
110812 9:18:54 [Note] Slave I/O thread: connected to master 'rel@192.168.250.20:3306',replication started in log 'mysql-bin.000714' at position 889713764
110812 9:18:54 [Note] Event Scheduler: Loaded 0 events
110812 9:18:54 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.53-log' socket: '/usr/local/mysql/tmp/mysql.sock' port: 3306 Source distribution
110812 9:18:54 [ERROR] Slave SQL: Could not execute Write_rows event on table csf.tmp_excel_data; Duplicate entry '629-2.1.1-27-17-13487' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000713, end_log_pos 1017000770, Error_code: 1062
110812 9:18:54 [Warning] Slave: Duplicate entry '629-2.1.1-27-17-13487' for key 'PRIMARY' Error_code: 1062
110812 9:18:54 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000713' position 1017000578


baidu,google了许多资料,但是不敢贸然下手,各位有经验的,告诉我如何一步步走,以便不要带来别的意外失误啊!
...全文
174 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mysqldbd 2011-08-16
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 zuoxingyu 的回复:]
110812 10:52:31 [ERROR] Slave SQL: Could not execute Write_rows event on table csf.tmp_excel_data;

检查磁盘是否够空间,检查文件是否有权限。
[/Quote]

检查了,这些都够了的啊!
mysqldbd 2011-08-12
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 rucypli 的回复:]
直接执行第二步就行
[/Quote]


日志里面报错如下:

110812 10:52:16 [Note] Slave I/O thread killed while reading event
110812 10:52:16 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000715', position 557195988
110812 10:52:31 [Note] Slave I/O thread: connected to master 'rel@192.168.250.20:3306',replication started in log 'mysql-bin.000715' at position 557195988
110812 10:52:31 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000713' at position 1017000578, relay log './relay-bin.000584' position: 251
110812 10:52:31 [Note] 'SQL_SLAVE_SKIP_COUNTER=1' executed at relay_log_file='./relay-bin.000584', relay_log_pos='251', master_log_name='mysql-bin.000713', master_log_pos='1017000578' and new position at relay_log_file='./relay-bin.000584', relay_log_pos='508', master_log_name='mysql-bin.000713', master_log_pos='1017000835'
110812 10:52:31 [ERROR] Slave SQL: Could not execute Write_rows event on table csf.tmp_excel_data; Duplicate entry '629-2.1.1-27-18-13487' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000713, end_log_pos 1017001027, Error_code: 1062
110812 10:52:31 [Warning] Slave: Duplicate entry '629-2.1.1-27-18-13487' for key 'PRIMARY' Error_code: 1062
110812 10:52:31 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000713' position 1017000835

rucypli 2011-08-12
  • 打赏
  • 举报
回复
直接执行第二步就行
mysqldbd 2011-08-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zuoxingyu 的回复:]
step 1:
select * from csf.tmp_excel_data where pkcol=''629-2.1.1-27-17-13487',if exists,goto step 2

step2:
run
slave stop;
set sql_slave_skip_counter=1;
slave start;
show slave status \G

……
[/Quote]

执行这一步:select * from csf.tmp_excel_data where pkcol='629-2.1.1-27-17-13487';
报错如下:
Error Code: 1054. Unknown column 'pkcol' in 'where clause'
zuoxingyu 2011-08-12
  • 打赏
  • 举报
回复
step 1:
select * from csf.tmp_excel_data where pkcol=''629-2.1.1-27-17-13487',if exists,goto step 2

step2:
run
slave stop;
set sql_slave_skip_counter=1;
slave start;
show slave status \G

then keep monitor the slave status.
zuoxingyu 2011-08-12
  • 打赏
  • 举报
回复
110812 10:52:31 [ERROR] Slave SQL: Could not execute Write_rows event on table csf.tmp_excel_data;

检查磁盘是否够空间,检查文件是否有权限。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧