Reputation: 2871
We have big data project. We have two servers, one for parsing information, and second is for our website.
The problem is, we have mysql slave needs to change few records now and then. How can we sync that info back to master ?
The query is very simple and looks like this:
UPDATE domains SET views = views + 1 WHERE id = $DOMAIN_ID
Upvotes: 1
Views: 444
Reputation: 65547
One way to do this is to make your first server a slave of the second server as well, giving you what is referred to as a master-master replication setup.
So instead of this:
db1 -> db2
You have this:
db1 <-> db2
In order for that to work you need to make sure the two servers each have a unique server_id
value, both of them have binary logging enabled, and you should either disable the read_only
option on the second server (if it's currently enabled), or do the updates on the second server with a user who has super
privilege.
Upvotes: 2