The basic mechanics of replication is based on the master server
keeping track of all changes to your databases (updates, deletes,
and so on) in its binary logs. The binary log serves as a written
record of each to the database from the moment the database was
started. The binary log contains records of all the statements which
edit or modify either the database structure or the data that the
structure contains. Typically
statements are not recorded, as they do not modify the database data
Each slave that connects to the master receives a copy of the binary log, and executes the events within the binary log. This has the effect of repeating the original statements and changes just as they were made on the master. Tables are created or their structure modified, and data is inserted, deleted and updated according to the statements that were originally executed on the master.
Because each slave is independent, the replaying of the statements in the masters binary log can occur on each slave that is connected to the master. In addition, because each slave only receives a copy of the binary log by requesting it from the master (it pulls the data from the master, rather than the master pushing the data to the slave), the slave is able to read and update the copy of the database at its own pace and rate and can start and stop the replication process at will without affecting the master or the slaves ability to update to the latest database status.
For more information on the specifics of the replication implementation, see Section 16.4.1, “Replication Implementation Details”.
Slaves and masters report their status in respect of the replication process regularly so that you can monitor the situation. For information on slave states, see Section 126.96.36.199, “Replication Slave I/O Thread States”, and Section 188.8.131.52, “Replication Slave SQL Thread States”. For master states, see Section 184.108.40.206, “Replication Master Thread States”.
The master binary log is written to a local relay log on the slave before it is processed. The slave also records information about the current position with the master's binary log and the local relayed log. See Section 16.4.2, “Replication Relay and Status Files”.
Databases and tables are updated on the slave according to a set of rules that are applied according to the various configuration options and variables that control statement evaluation. For details on how these rules are applied, see Section 16.4.3, “How Servers Evaluate Replication Filtering Rules”.