More DBA job interview questions and answers at
(Continued from previous question...)
Replication in MySQL
One way replication can be used is to increase both robustness and speed. For robustness you can have two systems and can
switch to the backup if you have problems with the master. The extra speed is achieved by sending a part of the non-updating
queries to the replica server. Of course this only works if non-updating queries dominate, but that is the normal case.
Starting in Version 3.23.15, MySQL supports one-way replication internally. One server acts as the master, while the other
acts as the slave. Note that one server could play the roles of master in one pair and slave in the other. The master server
keeps a binary log of updates and an index file to binary logs to keep track of log
rotation. The slave, upon connecting, informs the master where it left off since the last successfully propagated update,
catches up on the updates, and then blocks and waits for the master to notify it of the new updates.
Note that if you are replicating a database, all updates to this database should be done through the master!
On older servers one can use the update log to do simple replication.
Another benefit of using replication is that one can get live backups of the system by doing a backup on a slave instead of
doing it on the master.
(Continued on next question...)