MySQL Forums
Forum List  »  Knowledge Base

Sync Of Two Databases
Posted by: Jiang HaiZhong
Date: January 04, 2009 11:59PM

Hi,I wanna Sync two databases ,
as the modes of A<=>B,each database has the master and slave properties.
Because of the Two databases are placed in different region,one is in America,
another is in China. so i must consider the issue of network during the Sync,

So i wanna sync the two databases every one minute,but how can do it?
for the configuration i have did, if i update one database,it will sync the
changes to the another database immediately, but how can i control it to sync
the changes every one minute?

another problem "primary key confliction" maybe come out if i adopt the way of
sync the databases every one mintue.

for example
A:
id: primary key(auto_increment)
1


B:
id: primary key(auto_increment)
100

before i do the sync,i do the insert.
insert into A values(null);
insert into B values(null);

then it will become:
A:
id:
1
2

B:
id:
100
101

after do the sync,it will become
A:
id:
1
2
101

B:
id:
100
101
2:

surely,there is no problem for the first sync;

But when i do the second insert,the probelms occurs:
insert into A values(null);
insert into B values(null);
A:
id:
1
2
101
102 #confliction

B:
100
101
2
102 #confliction

then it will occur the 'primary key confliction' problem if i do the Sync.

so my question is: how can i avoid the 'primary key confliction'problem if
i do the sync every one minute?
i know there is no problem if do the sync immediataly ,not every one minute.


Best Regards
Nicholas

Options: ReplyQuote


Subject
Views
Written By
Posted
Sync Of Two Databases
4987
January 04, 2009 11:59PM


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.