2

I want to setup mysql replication between two servers one of them is my localhost and the other is online server. I have all availability to make any one of them the master. But according to that my localhost server doesn't have a static IP, i need to know which server of the two (master & slave) is the one which requests the other for doing updates. Does the master sends the binlog updates, or the slave is the one which requests for new updates periodically ? so i will make it the localhost. thank you in advance.

2 Answers 2

0

according to this reference: Get MySQL Replication up and running in 5 minutes, Slave must access master to initialize.

slave> CHANGE MASTER TO MASTER_HOST='192.168.0.31',
 -> MASTER_USER='repl_user',
 -> MASTER_PASSWORD='billy',
 -> MASTER_LOG_FILE='',
 -> MASTER_LOG_POS=4;

So, you can setup slave in localhost and master in remote host with accessible IP and port.

This is a client server communication:

enter image description here

0

Logically, the Primary 'pushes' data to the Replica.

Actually, the Replica connects to the Primary and 'pulls' the data.

So, it is more important to have a static IP, or a DNS lookup, so that the Replica can find the Primary.

3
  • Are there workarounds for that? I have a scenario where the slave is in a network segment that can not establish connections to the master, but the other direction is accepted.
    – Benni
    Jun 16, 2022 at 9:08
  • @Benni - ssh with suitable options can establish the connection in the "other" direction. (Sorry, I don't have the details.)
    – Rick James
    Jun 19, 2022 at 4:54
  • Sure, but then we are in "circumventing the decision from the networking team by creating your own tunnel" territory :)
    – Benni
    Jun 19, 2022 at 17:25

Your Answer

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