<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL

        來源:懂視網 責編:小采 時間:2020-11-09 19:20:06
        文檔

        Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL

        Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL:In complex systems it's often useful to be able to receive notification when rows have been modified in MySQL so that you can invalidate various external caches or indexes. For example: memcached, Sphinx, Lucene.In the case of MySQL's defau
        推薦度:
        導讀Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL:In complex systems it's often useful to be able to receive notification when rows have been modified in MySQL so that you can invalidate various external caches or indexes. For example: memcached, Sphinx, Lucene.In the case of MySQL's defau

        In complex systems it's often useful to be able to receive notification when rows have been modified in MySQL so that you can invalidate various external caches or indexes. For example: memcached, Sphinx, Lucene.

        In the case of MySQL's default statement-based replication this can be quite tricky to do, as it would likely require an SQL parser to determine what was intended to be modified. However, this is made much simpler with Row-based Replication (something Irecommend switching to).

        AC++ library existsto be able to listen to MySQL replication, but what I want to demonstrate is that it is also very simple to be able to do this withmysqlbinlog:


        shell> mysqlbinlog --read-from-remote-server --stop-never --host localhost.localdomain --port 5616 -u msandbox -pmsandbox --verbose mysql_sandbox5616-bin.000004 | grep '^### '

        To explain how this command works:

      1. --read-from-remote-servertells mysqlbinlog to act like a slave, and fetch remote files rather than local (new option to 5.6).
      2. --stop-nevermakes mysqlbinlog block waiting for a continual stream of updates, rather than exiting. Perfect!
      3. --verboserewrites row-based replication events to be pseudo SQL statements. The pseudo statements are very easy to parse. For example:
        ### DELETE FROM `test2`.`a`### WHERE### @1=1### INSERT INTO `test2`.`a`### SET### @1=1### UPDATE `test2`.`a`### WHERE### @1=10### SET### @1=20

        Noting that a multi-row statement will appear as individual statements via--verbose. Row-based events also default to sendingall columns in the row, not just those that are changed.

      4. Thegrep '^### 'statement is just a lazy way of stripping out everythingexceptpseudo SQL statements.
      5. Advanced Usage

        You can fairly easily extend the above to track your progress reading through the master's binary logs. This will make it easier to resume from where you left off if there is a crash. Just remove the grep, and keep track of:

      6. Positional markers just before DML events. These are marked in bold here:
        # at 191#140526 15:28:27 server id 10end_log_pos 239 CRC32 0x559a84a8 GTID [commit=yes]SET @@SESSION.GTID_NEXT= '9f0ce61c-bb92-11e3-89fd-f056da47d247:17'/*!*/;# at 239#140526 15:28:27 server id 10end_log_pos 312 CRC32 0xff074c19 Query thread_id=1 exec_time=0 error_code=0SET TIMESTAMP=1401143307/*!*/;BEGIN/*!*/;# at 312#140526 15:28:27 server id 10end_log_pos 357 CRC32 0x74b1ad7f Table_map: `test2`.`a` mapped to number 71# at 357#140526 15:28:27 server id 10end_log_pos 397 CRC32 0x2c6f8b8d Write_rows: table id 71 flags: STMT_END_FBINLOG 'C8CDUxMKAAAALQAAAGUBAAAAAEcAAAAAAAEABXRlc3QyAAFhAAEDAAF/rbF0C8CDUx4KAAAAKAAAAI0BAAAAAEcAAAAAAAEAAgAB//4KAAAAjYtvLA=='/*!*/;### INSERT INTO `test2`.`a`### SET### @1=10
      7. Events that show that the binary log file itself is being rotated. For example, the result ofFLUSH LOGSis:
        # at 4#691231 16:00:00 server id 10end_log_pos 0 CRC32 0x7800af55 Rotate to mysql_sandbox5616-bin.000006pos: 4
      8. Conclusion

        This might not be as robust in all cases as using the C++ API, but it sure beats the alternative. Gone are my days of writing complex sets of triggers to write to an "events" table, which I poll continually from an external script.

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL

        Fakingaslave:Subscribingtomysqlrow-based-replicationc_MySQL:In complex systems it's often useful to be able to receive notification when rows have been modified in MySQL so that you can invalidate various external caches or indexes. For example: memcached, Sphinx, Lucene.In the case of MySQL's defau
        推薦度:
        標簽: re to mysql
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 免费高清av一区二区三区| 岛国av无码免费无禁网站| 亚洲国产精品13p| 青草久久精品亚洲综合专区| 一二三四免费观看在线视频中文版 | 亚洲av中文无码字幕色不卡 | 特级精品毛片免费观看| 亚洲AV区无码字幕中文色| 国产无遮挡无码视频免费软件 | 亚洲国产中文在线二区三区免| 99久久久国产精品免费牛牛| 九一在线完整视频免费观看| 免费大黄网站在线观| 一级毛片无遮挡免费全部| 亚洲综合av永久无码精品一区二区 | 亚洲第一黄色网址| 中国一级特黄高清免费的大片中国一级黄色片| 亚洲综合国产精品第一页| 中文字幕的电影免费网站| 久久水蜜桃亚洲av无码精品麻豆| 99久久99久久免费精品小说 | 免费精品国自产拍在线播放 | 久久99精品国产免费观看| 亚洲国产成人在线视频| 毛片免费视频在线观看| 精品成人一区二区三区免费视频 | 国产成人亚洲综合无| 激情综合色五月丁香六月亚洲| 你懂的免费在线观看网站| 99久久国产亚洲综合精品| 亚洲综合精品香蕉久久网| 91精品视频免费| 亚洲免费一区二区| 亚洲六月丁香六月婷婷色伊人 | 三年片免费高清版| 亚洲乱码日产精品BD在线观看| 免费看男女下面日出水视频| 永久在线观看免费视频 | xxxxxx日本处大片免费看| 亚洲理论片在线中文字幕| 亚洲国产91精品无码专区|