InnoDB active-standby replication

The difference between mysql database files
InnoDB and MyISAM The
principle of InnoDB isolation level to achieve
InnoDB primary and secondary replication

1. InnoDB primary and secondary replication

replication has three steps:
  • Log data changes to the Binary Log on the main library (these records are called binary log events).
  • Standby database I/O thread: Copy the log on the main database to its own relay log (Relay Log). If the thread catches up with the main library, it will go to sleep and will not be woken up until the main library sends a semaphore to notify it of a new event.
  • Standby database SQL thread: Read the events in the relay log and replay them on the standby database data.


2. Statement-based replication and row-based replication
Statement-based replication
  • Advantages: The process of performing replication in a statement-based manner is basically the execution of SQL statements. This means that all changes that happen on the server are run in an easy-to-understand way. Statement-based replication generally allows for more flexible operations.
  • Disadvantage: If you are using triggers or stored procedures, do not use statement-based replication mode unless it is clear that you will not encounter replication problems.

row-based replication
  • Advantages: Row-based replication records data changes, so what is actually recorded in the binary log is the data that actually changed on the primary database. Row-based replication consumes less CPU because there is no need to build an execution plan for the query and execute the query like statement-based replication.
  • Disadvantage: Since the statement is not recorded in the log, it is impossible to determine which SQL was executed.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326208051&siteId=291194637