mysql principle ~ binlog Series - The Basics

A brief introduction: We will continue to binlog analyzed, the default is Row format
two binlog record something specific content of
    1 update will record changes to the values of all the columns in front and change the
    values of all the columns before 2 delete will delete records
    3 insert will record inserted DETAILED sql
    . 4 DDL statement is only recorded statement itself, does not affect the recording line
    5 dcl statement does not record
    6 special type
       11 generates trigger sql statement recording the updated data. For data generated after the call trigger the update is not recorded in the binlog
       2 function if there is data change function, that function call statement (including a select statement) will be recorded in the binlog
       after 3 event event triggering events, updating data sql statement credited to the binlog, event function is disabled by default. After defining on the master event, slave synchronization event and labeled SLAVESIDE_DISABLED, special note here
    7 innodb myisam memory touckdb engine tables are recorded in the table does binlog log temp.
    8 special statement
       create table as select * from a recording in accordance insert a single, but belong to a transaction, be big things
two binlog -2 points for the transaction record
   1 record transaction information
      1 server_id
         1 binlog server_id executing the transaction in the database,
         2 even in a multi-stage cascade generated the binlog replication, server_id cluster does not change, it must be the master server_id
         . 3 double main architecture, if it is judged that own server_id, not It will be implemented to solve the infinite loop stop executing the transaction
         uniqueness of 4 GTID copy instead of forming a global model using GTID +

     2 CRC32 binlog_checksum encryption protocol, MGR architecture does not support

     3 Table_map target library table +

     table_id 4 Table_id target table

     5 type_event corresponds delete_event, update_event, insert_event delete updates and inserts (binlog_row_image = FULL (all record fields) = MINIMAL (key recording segment)

    6 contains the specific transaction specific values, see the first portion

     7 Xid event represents the transaction is correctly submitted

     8 at number binlog site specific information (for analysis by binlog)

2 GTID format will sum gtid executed before the beginning of the transaction records binlog, to facilitate scanning

Four management

     1 binlog_server off-site backup binlog

     2 Set expire_logs_days retention binlog date, the default save seven days

        Binlog manually delete log PURGE MASTER LOGS BEFORE DATE_SUB (CURRENT_DATE, INTERVAL N DAY);

     3 consumption binlog canal open source tools, and extended otter

     4 binlog2sql / MyFlash third-party analysis tools and rollback binlog

     5 muysqlbinlog system comes with binlog analysis tools for demand statistics, please note that only accurate to the library level

Five binlog in a complete transaction

          at position1 - "transaction begins
          BGEIN
          AT the Map Event -" mapping table
          at DML event - "DML operations (there may be more)
          AT XID Event -" XID event
          COMMIT
          AT position2 - "End Transaction

         From position1- to position2 is a complete transaction, according to the analysis to determine the position of a complete transaction

Guess you like

Origin www.cnblogs.com/danhuangpai/p/11484252.html