0

I have two websites, one master, one slave client (gotta be PC). Each has a SQL database. I'm working on a function to sync the two, but I need to detect if an entry has been deleted on one and not the other. Example:

Master: Apple, Orange, Banana
Client: Apple, Orange, Banana

Then the master user deletes Orange. A naive implementation would propagate Orange from client back to Master. How can I set it up so that either master or client can delete an entry, and it will be deleted on the other end?

4

2 に答える 2

1

Implementing your own multi-master replication scheme will be very difficult. But the good news for you is you don't have to. Multi-master replication for Mysql is already available.

于 2012-05-24T21:45:40.140 に答える
0

If you are writing a replication service and not using the built in system of your DB provider (you don't state which DB server you are using, but I'm guessing MS SQL Server) then you might do well to implement audit tables in your databases and then have your service send the audit rows back and forth.

That way you would know which edit happened when and be able to resolve the current data set.

To be honest if you can use a replication system "off the shelf" do so, writing your own is going to be difficult.

于 2012-05-24T21:40:38.270 に答える