Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  Replication

Chapter 19 Replication

Status of this section: up to date 2009-10-21

This chapter describes MySQL replication principles, rules, and code, as it is supposed to work in version 5.1.

The MySQL replication feature allows a server - the master - to send all changes to another server - the slave - and the slave tries to apply all changes to keep up-to-date with the master. Replication works as follows:

  • Whenever the master's database is modified, the change is written to a file, the so-called binary log, or binlog. This is done by the client thread that executed the query that modified the database.

  • The master has a thread, called the dump thread, that continuously reads the master's binlog and sends it to the slave.

  • The slave has a thread, called the IO thread, that receives the binlog that the master's dump thread sent, and writes it to a file: the relay log.

  • The slave has another thread, called the SQL thread, that continuously reads the relay log and applies the changes to the slave server.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.