這篇文章主要介紹了MySQL中從庫(kù)binlog如何使用mysqlbinlog stop-datetime過(guò)濾,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)公司擁有一支富有激情的企業(yè)網(wǎng)站制作團(tuán)隊(duì),在互聯(lián)網(wǎng)網(wǎng)站建設(shè)行業(yè)深耕10余年,專(zhuān)業(yè)且經(jīng)驗(yàn)豐富。10余年網(wǎng)站優(yōu)化營(yíng)銷(xiāo)經(jīng)驗(yàn),我們已為超過(guò)千家中小企業(yè)提供了網(wǎng)站制作、成都網(wǎng)站制作解決方案,按需開(kāi)發(fā),設(shè)計(jì)滿意,售后服務(wù)無(wú)憂。所有客戶(hù)皆提供一年免費(fèi)網(wǎng)站維護(hù)!
# 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是從庫(kù)的binlog,Event header timestamp如下:
FORMAT_DESCRIPTION_EVENT:190825 0:01:37
PREVIOUS_GTIDS_LOG_EVENT:190825 0:01:37
以上兩個(gè)Event都是從庫(kù)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
他們都是主庫(kù)語(yǔ)句命令發(fā)起的時(shí)間。
如果這個(gè)時(shí)候我們使用stop-datetime=‘2019-07-25 00:00:00’ 不會(huì)解析到這個(gè)事務(wù)。原因在于FORMAT_DESCRIPTION_EVENT的時(shí)間超過(guò)了這個(gè)時(shí)間直接退出了。
源碼如下:
debug如下:
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“MySQL中從庫(kù)binlog如何使用mysqlbinlog stop-datetime過(guò)濾”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!