Let’s just start with a simple example and we are tasked to deploy a database server. So we install and setup
MySQL on the server and create a database. Our database is now operational. Other applications can now
write data to our database.
1.
To withstand failures we are tasked to deploy a High Availability solution. So we deploy additional servers
and install MySQL on those as well. We have a blank database on the new servers.
2.
So how do we replicate the data from the original database to the new databases on the new servers.
Before we get into that,
3.
4. So back to our question on how do we replicate the database to the databases in the new server.
5. There are different topologies available.
The most straight forward one being a single master multi slave topology, where all writes come in to the
master server and reads can be served by either the master or any of the slaves servers.
So the master server should be setup first, before deploying the slaves. Once the slaves are deployed,
perform an initial clone of the database from the master server to the first slave.
6.
After the initial copy enable continuous replication from the master to that slave so that the database on the
slave node is always in sync with the database on the master.
7.
Note that both these slaves are configured with the address of the master host. When replication is
initialized you point the slave to the master with the master’s hostname or address.
8.
9. That way the slaves know where the master is