Implementing replication
The basis for replication is that the master database server keeps track of all the changes taking place on the master database. The changes are tracked in the binary log files in the form of events since the server was started. SELECT
operations are not recorded as they modify neither the database nor the contents. Each of the REPLICATION SLAVE
pull a copy of the binary log file from master
instead of a master database pushing the log file to the slave
. The slave in turn executes the events as it is read from the master's binary log file. This maintains the consistency between master
and slave
servers. In MySQL replication, each slave
functions independently from master
and other slave
servers. So, it is up to the slave to request the master's binary log file at a convenient time without impacting the master
or slave
functioning.
The focus for this section of the chapter is on MySQL replication details. We have already understood the basics, which will help us understand...