1

Hi I have just started reading about this replication concept and one thing I want to ask is that when we change something in the slave db how is it going to effect the master db? Is there a sync algo that will change it in master db as well? and another thing is if there are multiple databases can we apply replication on them as well? like multiple databases in masters server replicated into multiple databases in slave server. Thanks

asked Dec 17, 2015 at 5:49

2 Answers 2

1

How replication happens:

  • DMLs on Master are written to Binary logs.

  • Slave connects to master from it's IO thread and reads the binary logs. Save them as Relay log.

  • Slave's SQL Thread execute the Relay log SQLs to apply the changes.

Now, if you need slave's changes to be reflected on master, you need your master to be replicating from your slave as well. That's known as master-master replication. You can find plenty of posts around that.

By default, all the databases are replicated. If you want to replicate only few of the objects (DB / tables) there are replication filters for that.

answered Dec 17, 2015 at 7:10
0
0

"...when we change something in the slave" STOP. Do not do that!

Or do you want "dual master", which is two servers, each acting like both Master and Slave. But that can be a nightmare. Duplicate keys. AUTO_INCREMENT issues. Etc.

Using binlog/replicate_do/ignore_* (in my.cnf) you can control what is (or is not) sent out of the Master (binlog_) and what is not (or is) ignored by the Slave (replicate_).

answered Dec 18, 2015 at 5:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.