Re: Master-Slave with InnoDB
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.