MySQL Replication

原创
2015/03/29 12:04
阅读数 201

Replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves). 

Replication is asynchronous by default; slaves do not need to be connected permanently to receive updates from the master. 

Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.






Each binary logging format has advantages and disadvantages. 

For most users, the mixed replication format should provide the best combination of data integrity and performance.


Advantages of statement-based replication

    Less data written to log files.

   Log files contain all statements that made any changes, so they can be used to audit the database.

Disadvantages of statement-based replication


Advantages of row-based replication


Disadvantages of row-based replication


MySQL replication are implemented using three threads, one on the master server and two on the slave:

Binlog dump thread. The master creates a thread to send the binary log contents to a slave when the slave connects. 

The slave I/O thread reads the updates that the master's Binlog Dump thread sends and copies them to local files that comprise the slave's relay log.

Slave SQL thread. The slave creates an SQL thread to read the relay log that is written by the slave I/O thread and execute the events contained therein.

展开阅读全文
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部