MySQL Forums
Forum List  »  InnoDB

Re: Master-Slave with InnoDB
Posted by: emil öhgren
Date: July 19, 2011 02:14AM

Hi,
I followed your advice, But Im recieving errors:

I did the following for all the tables:
SHOW CREATE TABLE <tablename>;


And copied to the slave and created all the tables.
But I'm getting an error

Last_Errno: 1452
Last_Error: Error 'Cannot add or update a child row: a foreign key constraint fails (`customers`.`tracking`, CONSTRAINT `tracking_ibfk_2` FOREIGN KEY (`tracking_report_id`) REFERENCES `reports` (`reports_id`) ON DELETE CASCADE ON UPDATE NO ACTION)' on query. Default database: 'affiliator'. Query: 'INSERT INTO tracking(tracking_ip1,tracking_ip2,tracking_ip3,tracking_ip4,tracking_user_agent,tracking_report_id) VALUES('232','200','141','1','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)','19149119')'



On the Slave:

mysql> describe tracking;
+---------------------+---------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+-------------------+-----------------------------+
| tracking_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| tracking_ip1 | tinyint(3) unsigned | YES | MUL | NULL | |
| tracking_ip2 | tinyint(3) unsigned | YES | | NULL | |
| tracking_ip3 | tinyint(3) unsigned | YES | | NULL | |
| tracking_ip4 | tinyint(3) unsigned | YES | | NULL | |
| tracking_user_agent | text | YES | | NULL | |
| tracking_timestamp | timestamp | YES | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| tracking_report_id | int(10) unsigned | YES | MUL | NULL | |
+---------------------+---------------------+------+-----+-------------------+-----------------------------+



On the master:
mysql> describe tracking;
+---------------------+---------------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+-------------------+----------------+
| tracking_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| tracking_ip1 | tinyint(3) unsigned | YES | MUL | NULL | |
| tracking_ip2 | tinyint(3) unsigned | YES | | NULL | |
| tracking_ip3 | tinyint(3) unsigned | YES | | NULL | |
| tracking_ip4 | tinyint(3) unsigned | YES | | NULL | |
| tracking_user_agent | text | YES | | NULL | |
| tracking_timestamp | timestamp | YES | | CURRENT_TIMESTAMP | |
| tracking_report_id | int(10) unsigned | YES | MUL | NULL | |
+---------------------+---------------------+------+-----+-------------------+----------------+


If i now check show create table tracking on both the slave and the master,
only the last line differs, "AUTO_INCREMENT=18543030" exists on the slave but not the master.

Options: ReplyQuote


Subject
Views
Written By
Posted
2948
July 13, 2011 01:43AM
1017
July 14, 2011 10:00AM
1052
July 15, 2011 12:04AM
783
July 15, 2011 10:13AM
1309
July 18, 2011 01:04AM
852
July 18, 2011 08:59AM
Re: Master-Slave with InnoDB
1755
July 19, 2011 02:14AM
908
July 19, 2011 09:04PM
909
July 20, 2011 01:40AM
1135
July 20, 2011 09:51AM
826
July 25, 2011 06:36AM
1099
July 25, 2011 09:26AM
1008
July 28, 2011 06:32AM
1011
S D
August 09, 2011 03:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.