{"id":1826,"date":"2020-07-01T06:01:32","date_gmt":"2020-06-30T22:01:32","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1826"},"modified":"2020-07-01T06:01:32","modified_gmt":"2020-06-30T22:01:32","slug":"mysqlbinlog_flashback%e5%b7%a5%e5%85%b7%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1826","title":{"rendered":"mysqlbinlog_flashback\u5de5\u5177\u4f7f\u7528"},"content":{"rendered":"<article>mysqlbinlog_back.py \u662f\u5728\u7ebf\u8bfb\u53d6row\u683c\u5f0f\u7684mysqld\u7684binlog,\u7136\u540e\u751f\u6210\u53cd\u5411\u7684sql\u8bed\u53e5\u7684\u5de5\u5177\u3002<br \/>\n\u4e00\u822c\u7528\u4e8e\u6570\u636e\u6062\u590d\u7684\u76ee\u7684\u3002 \u6240\u8c13\u53cd\u5411\u7684sql\u8bed\u53e5\u5c31\u662f\u5982\u679c\u662finsert\uff0c\u5219\u53cd\u5411\u7684sql\u4e3adelete\u3002<br \/>\n\u5982\u679cdelete,\u53cd\u5411\u7684sql\u662finsert,\u5982\u679c\u662fupdate, \u53cd\u5411\u7684sql\u8fd8\u662fupdate,\u4f46\u662fupdate\u7684\u503c\u662f\u539f\u6765\u7684\u503c\u3002<br \/>\n\u8fd9\u4e2a\u9879\u76ee\u9700\u8981\u5b89\u88c5\u4f9d\u8d56<\/p>\n<div>\n<pre>yum install python-pip\npip install pymysql\n<\/pre>\n<\/div>\n<p>\u5b98\u65b9\u5730\u5740\uff1a<a href=\\\"https:\/\/github.com\/58daojia-dba\/mysqlbinlog_flashback\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">https:\/\/github.com\/58daojia-dba\/mysqlbinlog_flashback<\/a><br \/>\n\u4f7f\u7528\u9650\u5236\uff1a<\/p>\n<ul>\n<li>1.mysql binlog\u5fc5\u987b\u662frow\u683c\u5f0f\u7684\u3002<\/li>\n<li>2.\u53cd\u5411\u751f\u6210\u7684\u8868\u5fc5\u987b\u6709\u4e3b\u952e\u3002<\/li>\n<li>3.\u65e5\u5fd7\u5fc5\u987b\u5728\u4e3b\u5e93\u5b58\u5728<\/li>\n<li>4.\u53cd\u5411\u751f\u6210\u7684mysql\u6570\u636e\u7c7b\u578b\u5217\u51fa\u5728\u4e0b\u9762\u3002\u6ca1\u6709\u5217\u51fa\u7684\u7c7b\u578b\u6ca1\u6709\u7ecf\u8fc7\u4e25\u683c\u7684\u6d4b\u8bd5\uff0c\u4e5f\u8bb8\u6709\u95ee\u9898<\/li>\n<li>5.\u652f\u6301\u7684\u7c7b\u578b<br \/>\n\u5141\u8bb8\u89e3\u6790\u7684\u5b57\u6bb5\u7c7b\u578b\uff0c\u4e0d\u5728\u91cc\u9762\u7684\u4f1a\u62a5\u9519<br \/>\nALLOW_TYPE={ \\&#8221;varchar\\&#8221;:True, \\&#8221;char\\&#8221;:True, \\&#8221;datetime\\&#8221;:True, \\&#8221;date\\&#8221;:True, \\&#8221;time\\&#8221;:True, \\&#8221;timestamp\\&#8221;:True, \\&#8221;bigint\\&#8221;:True, \\&#8221;mediumint\\&#8221;:True, \\&#8221;smallint\\&#8221;:True, \\&#8221;tinyint\\&#8221;:True, \\&#8221;int\\&#8221;:True, \\&#8221;smallint\\&#8221;:True, \\&#8221;decimal\\&#8221;:True, \\&#8221;float\\&#8221;:True, \\&#8221;double\\&#8221;:True, \\&#8221;longtext\\&#8221;:True, \\&#8221;tinytext\\&#8221;:True, \\&#8221;text\\&#8221;:True, \\&#8221;mediumtext\\&#8221;:True }<\/li>\n<\/ul>\n<p>\u5de5\u5177\u5b89\u88c5\uff1a<br \/>\n\u53ef\u5728GitHub\u4e0a\u4e0b\u8f7d\u5b89\u88c5\u5305<br \/>\n\u76f4\u63a5\u89e3\u538b\u7f29\u5373\u53ef \u89e3\u538b\u540e\u8fdb\u5165\u76ee\u5f55\u5982\u4e0b\uff1a<\/p>\n<div>\n<div>\n<div><\/div>\n<div data-width=\\\"609\\\" data-height=\\\"438\\\"><img src=\\\"https:\/\/upload-images.jianshu.io\/upload_images\/11096896-ae5aeb0fce855127.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/609\/format\/webp\\\" data-original-src=\\\"\/\/upload-images.jianshu.io\/upload_images\/11096896-ae5aeb0fce855127.png\\\" data-original-width=\\\"609\\\" data-original-height=\\\"438\\\" data-original-format=\\\"image\/png\\\" data-original-filesize=\\\"42739\\\" data-image-index=\\\"0\\\" \/><\/div>\n<\/div>\n<div>mysqlbinlog_flashback.png<\/div>\n<\/div>\n<p>\u5de5\u5177\u4f7f\u7528\uff1a<\/p>\n<div>\n<pre># \u67e5\u770b\u4e0b\u53c2\u6570\u4f7f\u7528\u8bf4\u660e\npython mysqlbinlog_back.py --help\n# \u56de\u6eda\u67d0\u4e2a\u8868\npython mysqlbinlog_back.py --host=\\\"192.168.1.60\\\" --port=3306 --username=\\\"root\\\" --password=\\\"yourpassword\\\" --schema=test --tables=\\\"test_tb\\\" -S \\\"mysql-bin.000009\\\"\n<\/pre>\n<\/div>\n<p>\u56de\u6eda\u5b8c\u6210\u540e\u4f1a\u5728mysqlbinlog_flashback-master\/log\u76ee\u5f55\u4e0b\u751f\u6210\u56de\u6eda\u8bed\u53e5<br \/>\n\u4e4b\u540e\u6267\u884c\u4ee5\u4e0b\u8bed\u53e5\u5728\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u56de\u6eda<\/p>\n<div>\n<pre>mysql -uroot -pyourpassword --default-character-set=utf8mb4 test &lt; flashback_test_20170912_170610.sql<\/pre>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>mysqlbinlog_back.py \u662f\u5728\u7ebf\u8bfb\u53d6row\u683c\u5f0f\u7684mysqld\u7684binlog,\u7136\u540e\u751f\u6210\u53cd\u5411\u7684sql &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1826\"> <span class=\"screen-reader-text\">mysqlbinlog_flashback\u5de5\u5177\u4f7f\u7528<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":1,"uagb_excerpt":"mysqlbinlog_back.py \u662f\u5728\u7ebf\u8bfb\u53d6row\u683c\u5f0f\u7684mysqld\u7684binlog,\u7136\u540e\u751f\u6210\u53cd\u5411\u7684sql&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1826"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1826"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1826\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1826"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}