您的位置:首页 > 其它

同步故障Last_Errno:1061

2015-07-01 09:00 183 查看
1051处理完又出现好多1061的错误。

mysql>show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 10.128.45.8

Master_User: slave

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000036

Read_Master_Log_Pos: 259947402

Relay_Log_File: mysqld-relay-bin.000039

Relay_Log_Pos: 795208907

Relay_Master_Log_File: mysql-bin.000016

Slave_IO_Running: Yes

Slave_SQL_Running: No

Last_Errno: 1061

Last_Error: Error 'Duplicate key name 'Index_Feed_Record_Time'' on query. Default database: 'storefeedback500'. Query: 'ALTER TABLE feedback_record ADD INDEX `Index_Feed_Record_Time` USING BTREE(`feedback_time`)'

error log报错如下:

2015-06-24 08:44:09 2804 [ERROR] Slave SQL: Error 'Duplicate key name 'Index_Feed_Record_person'' on query. Default database: 'storefeedback500'. Query:
'ALTER TABLE feedback_record ADD INDEX `Index_Feed_Record_person` USING BTREE(`feedback_person_id`)', Error_code: 1061

2015-06-24 08:44:09 2804 [Warning] Slave: Duplicate key name 'Index_Feed_Record_person' Error_code: 1061

2015-06-24 08:44:09 2804 [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.000016' position 795212720

2015-06-24 08:48:32 2804 [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0

2015-06-24 08:48:32 2804 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000016' at position 795212720, relay log './mysqld-relay-bin.000039' position: 795212883

从库中已经存在相关索引,主库再添加则报错。原因还没弄清楚。

查看从库

mysql> show index from feedback_record;
+--------------+---------+---------------+-----------+------------+----------+------------+---------+-------+------+---------+------+-----+

| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |

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

| feedback_record | 0 | PRIMARY
| 1 | id | A | 1424178 | NULL | NULL |
| BTREE | | |

| feedback_record | 1 | FK_Reference_10
| 1 | feedback_id | A | 41
| NULL | NULL | YES | BTREE | | |

| feedback_record | 1 | Index_Feed_Record_person | 1 | feedback_person_id | A | 20
| NULL | NULL | YES | BTREE | | |

| feedback_record | 1 | Index_Feed_Record_Time
| 1 | feedback_time | A | 27388
| NULL | NULL |
| BTREE | | |

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

可以手动删除报错的索引,解决如下:

mysql> use storefeedback500

mysql> drop index feedback_index_sponsor_id on feedback;

mysql> start slave

参考:

http://blog.itpub.net/15456724/viewspace-682681/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: