Sunday, December 26, 2010

Duplicate entry for key 1′ on query

If the slave show the following error then skip the same as below.

mysql> show slave status\G
*************************** 1. row ***************************
Master_Host: x.x.4.3
Master_User: replicate
Master_Port: 3307
Connect_retry: 60
Master_Log_File: master.077
Read_Master_Log_Pos: 7394212
Relay_Log_File: slave- relay-bin.010
Relay_Log_Pos: 150588010
Relay_Master_Log_File: master.076
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_do_db: bandnew,archive
Replicate_ignore_db:
Last_errno: 1062
Last_error: Error ‘Duplicate entry ‘122453106710.31.87.80-mdazaz123-2008-10-21 03:38:23′ for key 1′ on query. Default database: ‘bandnew’. Query:

‘insert into br_info(UI_ID,UI_USER,CD_CAF,BI_PRODUCT,BI_STIME,BI_ETIME,BI_TIMEUTILIZED,BI_OPENINGBAL,BI_CLBAL,

BI_BILLEDAMT,BI_USERIP,BI_SERVICENAME,BI_BYTESIN,BI_BYTESOUT,BI_BYTES,BI_REMARKS,BI_PUBLICIP,BI_SAMIP) values

(’122453106710.31.87.80′,’mdz123′,’Default’,'D4NL’,'2008-10-21 03:38:23′,

‘2008-10-21 06:10:24′,152,197.09,195.08,’2.01′,’10.31.87.80′,’F',295137740,125414454,420552194,’D',’118.9.4.47′,’210.1.80.3′)’
Skip_counter: 0
Exec_master_log_pos: 150587868
Relay_log_space: 157983746
1 row in set (0.00 sec)

mysql> set global sql_slave_skip_counter=1;start slave;show slave status\G
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

*************************** 1. row ***************************
Master_Host: x.x.4.3
Master_User: replicate
Master_Port: 3307
Connect_retry: 60
Master_Log_File: master.077
Read_Master_Log_Pos: 7394212
Relay_Log_File: slave- relay-bin.010
Relay_Log_Pos: 150588010
Relay_Master_Log_File: master.076
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_do_db: bandnew,archive
Replicate_ignore_db:
Last_errno: 0
Last_error:
Skip_counter: 1
Exec_master_log_pos: 150587868
Relay_log_space: 157983746
1 row in set (0.00 sec)

No comments:

Post a Comment