V
V
Viktor Safronov2015-10-13 07:43:31
MySQL
Viktor Safronov, 2015-10-13 07:43:31

MySQL replication: the easiest way to swap master and slave twice?

There are two MariaDB 10.0.21 servers, between which the usual Master-> Slave replication is configured.
Both servers need to be moved to another city without stopping the service, so I need to turn off the master at some point, transfer users to work with the slave, then turn on the master in another place, make it pick up everything fresh from the slave, transfer the service back, turn off and move the slave, turn it on in a new place and again force it to take the current information from the master.
How to do this correctly so that you do not have to deploy replication from scratch at each stage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Fedoseev, 2015-10-13
@martin74ua

Start the move from the slave.
The slave moves to a new location, turns on, catches up with the master.
Now you configure the slave as a master for replication, connect the master to it as a slave.
Get master-master replication.
Just pay attention to the parameters
auto_increment_increment=2
auto_increment_offset=1
on both servers offset must be different. On one 1, on the second 0 -
This will protect against duplicate keys when inserting records on different servers at the same time.
Well, now you switch clients to the transported server, stop the old master and transport it. After the move, turn it on - it is synchronized .... Well, that's all, I would leave it like that, in master-master mode ....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question