artyomboyko
artyomboyko

Reputation: 2871

Mysql send info from slave to master

We have big data project. We have two servers, one for parsing information, and second is for our website.

  1. First server is: parser server / data collecting (MySQL Master)
  2. Second server is: website server (MySQL Slave)

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

Answers (1)

Ike Walker
Ike Walker

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

Related Questions