error from master 1


Error 'Cannot add or update a child row: a foreign key constraint fails (stylanzo_live.report_viewed_product_index, CONSTRAINT FK_REPORT_VIEWED_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (product_id) REFERENCES catalog_product_entity (entity_id) ON)' on query. Default database: 'stylanzo_live'. Query: 'INSERT INTO report_viewed_product_index (visitor_id,customer_id,product_id,store_id,added_at) VALUES (NULL, NULL, '1092', '23', '2015-05-28 19:20:00') ON DUPLICATE KEY UPDATE visitor_id = VALUES(visitor_id), customer_id = VALUES(customer_id), product_id = VALUES(product_id), store_id = VALUES(store_id), added_at = VALUES(added_at)' Replicate_Ignore_Server_Ids:

error from master 2


Error 'Duplicate entry '157493' for key 'PRIMARY'' on query. Default database: 'stylanzo_live'. Query: 'INSERT INTO log_visitor (session_id, first_visit_at, last_visit_at, last_url_id, store_id) VALUES ('7059f889233675a315cd2a35a92e2480', '2015-05-28 19:20:27', '2015-05-28 19:20:27', '0', '23')

SELECT create_statement FROM common_schema.sql_foreign_keys WHERE TABLE_SCHEMA='report_viewed_product_index';

Also, when I am starting replication it shows duplicate error again.


If you are writing to both Masters, then you have found two reasons not to write to both masters. Instead, write only to one Master, and leave the other as a "hot standby".

Discuss the details of inserting into log_visitor, maybe we can help you unravel it. There is a skip counter to get past something like a dup key and get replication going again; you may have to use it.

| improve this answer | |

thank you for your support.

I have already skip the error cause from my replication by adding skip parameter in my.cnf file. reset i am looking form a db that can help to speepup my e commerce website. i guess mongodb would be the right option. we are currently using mysql as a DB.

| improve this answer | |
  • As a good practise, do not skip the errors, identify the error and fix it on slave. The speed of your website depends on many factors such as quality of sql queries, hard disk type, amount of memory, computation capacity, etc. – Rathish Mar 6 '19 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.