您好,登錄后才能下訂單哦!
這篇文章主要介紹了MySQL中從庫binlog如何使用mysqlbinlog stop-datetime過濾,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
# at 4 #190825 0:01:37 server id 953340 end_log_pos 123 CRC32 0x9409b3c9 Start: binlog v 4, server v 5.7.22-22-debug-log created 190825 0:01:37 # Warning: this binlog is either in use or was not closed properly. BINLOG ' YV9hXQ/8iw4AdwAAAHsAAAABAAQANS43LjIyLTIyLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA AcmzCZQ= '/*!*/; # at 123 #190825 0:01:37 server id 953340 end_log_pos 234 CRC32 0x483a41ac Previous-GTIDs # 010fde77-2075-11e9-ba07-5254009862c0:16-40, # cb7ea36e-670f-11e9-b483-5254008138e4:94-104 # at 234 #190724 14:07:36 server id 413340 end_log_pos 299 CRC32 0x9294741b GTID last_committed=0 sequence_number=1 rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= 'cb7ea36e-670f-11e9-b483-5254008138e4:105'/*!*/; # at 299 #190724 14:07:36 server id 413340 end_log_pos 362 CRC32 0x23ecd791 Query thread_id=5 exec_time=2714050 error_code=0 SET TIMESTAMP=1563948456/*!*/; SET @@session.pseudo_thread_id=5/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=524288/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; SET @@session.character_set_client=83,@@session.collation_connection=83,@@session.collation_server=33/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; # at 362 #190724 14:07:36 server id 413340 end_log_pos 414 CRC32 0x65673dab Table_map: `testmts`.`testwq` mapped to number 110 # at 414 #190724 14:07:36 server id 413340 end_log_pos 454 CRC32 0xa368ded1 Write_rows: table id 110 flags: STMT_END_F BINLOG ' qPU3XROcTgYANAAAAJ4BAAAAAG4AAAAAAAEAB3Rlc3RtdHMABnRlc3R3cQABAwABqz1nZQ== qPU3XR6cTgYAKAAAAMYBAAAAAG4AAAAAAAEAAgAB//4KAAAA0d5oow== '/*!*/; # at 454 #190724 14:07:36 server id 413340 end_log_pos 485 CRC32 0x40df9d14 Xid = 44 COMMIT/*!*/;
這個(gè)binlog是從庫的binlog,Event header timestamp如下:
FORMAT_DESCRIPTION_EVENT:190825 0:01:37
PREVIOUS_GTIDS_LOG_EVENT:190825 0:01:37
以上兩個(gè)Event都是從庫binlog自己生成當(dāng)然就是本實(shí)例的時(shí)間。
GTID_LOG_EVENT:190724 14:07:36
QUERY_EVENT:190724 14:07:36
MAP_EVENT:190724 14:07:36
WRITE_EVET:190724 14:07:36
XID_EVENT:190724 14:07:36
他們都是主庫語句命令發(fā)起的時(shí)間。
如果這個(gè)時(shí)候我們使用stop-datetime=‘2019-07-25 00:00:00’ 不會(huì)解析到這個(gè)事務(wù)。原因在于FORMAT_DESCRIPTION_EVENT的時(shí)間超過了這個(gè)時(shí)間直接退出了。
源碼如下:
debug如下:
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“MySQL中從庫binlog如何使用mysqlbinlog stop-datetime過濾”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。