{"id":307093,"date":"2024-01-02T20:49:40","date_gmt":"2024-01-02T12:49:40","guid":{"rendered":"https:\/\/www.idc.net\/help\/307093\/"},"modified":"2024-01-02T20:49:40","modified_gmt":"2024-01-02T12:49:40","slug":"%e8%a2%ab%e9%9d%a2%e8%af%95%e5%ae%98%e9%97%ae%e4%bd%8f%e4%ba%86%ef%bc%8cmysql%e4%b8%a4%e9%98%b6%e6%ae%b5%e6%8f%90%e4%ba%a4%e6%98%af%e4%bb%80%e4%b9%88%e9%ac%bc%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/307093\/","title":{"rendered":"\u88ab\u9762\u8bd5\u5b98\u95ee\u4f4f\u4e86\uff0cMySQL\u4e24\u9636\u6bb5\u63d0\u4ea4\u662f\u4ec0\u4e48\u9b3c\uff1f"},"content":{"rendered":"<p style=\"text-align:center\">\n<h2>\u524d\u8a00<\/h2>\n<p style=\"text-align: justify\">MySQL\u901a\u8fc7\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u673a\u5236\uff0c\u4fdd\u8bc1\u4e86redo log\u548cbin log\u7684\u903b\u8f91\u4e00\u81f4\u6027\uff0c\u8fdb\u800c\u4fdd\u8bc1\u4e86\u6570\u636e\u7684\u4e0d\u4e22\u5931\u4ee5\u53ca\u4e3b\u4ece\u5e93\u7684\u6570\u636e\u4e00\u81f4\u3002<\/p>\n<p style=\"text-align: justify\">\u800c\u8bf4\u8d77\u4e24\u9636\u6bb5\u63d0\u4ea4\uff0c\u5c31\u4e0d\u5f97\u4e0d\u5148\u4ecb\u7ecd\u4e00\u4e0bredo log\u548cbin log\u3002<\/p>\n<h2>redo log<\/h2>\n<p style=\"text-align: justify\">redo log\u5373\u91cd\u505a\u65e5\u5fd7\uff0c\u662fInnoDB\u5f15\u64ce\u7279\u6709\u7684\u4e00\u79cd\u65e5\u5fd7\uff08\u6709\u7684\u9762\u8bd5\u5b98\u7ecf\u5e38\u95ee\u5230\u8fd9\u4e00\u70b9\uff09\u3002<\/p>\n<p style=\"text-align: justify\">redo log\u4e3b\u8981\u505a\u4ec0\u4e48\u5462\uff1f<\/p>\n<p style=\"text-align: justify\">\u4ee5\u66f4\u65b0\u6570\u636e\u4e3a\u4f8b\uff0c\u6211\u4eec\u77e5\u9053\uff0cMySQL\u7684\u6570\u636e\u662f\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\u7684\uff0c\u5982\u679c\u6bcf\u4e00\u6b21\u66f4\u65b0\u6570\u636e\uff0c\u90fd\u53bb\u78c1\u76d8\u5bfb\u5740\u627e\u5230\u8981\u66f4\u65b0\u7684\u6570\u636e\uff0c\u8fdb\u884c\u66f4\u65b0\u64cd\u4f5c\u7684\u8bdd\uff0c\u8fd9\u4e2aIO\u6210\u672c\u662f\u975e\u5e38\u9ad8\u7684\u3002<\/p>\n<p style=\"text-align: justify\">\u5982\u679c\u662f\u56fa\u6001\u786c\u76d8\u8fd8\u597d\uff0c\u5982\u679c\u662f\u673a\u68b0\u786c\u76d8\uff0c\u90a3\u4e48MySQL\u7684\u66f4\u65b0\u6027\u80fd\u6839\u672c\u65e0\u6cd5\u6ee1\u8db3\u6211\u4eec\u7684\u4e1a\u52a1\u9700\u8981\u3002<\/p>\n<p style=\"text-align: justify\">\u6240\u4ee5\uff0cMySQL\u91c7\u7528\u4e86\u4e00\u79cd\u53eb\u505aWAL\u7684\u6280\u672f\uff0cWrite-Ahead Logging\u3002<\/p>\n<p style=\"text-align: justify\"><span style=\"color: #ff5e5e\">\u5f53\u66f4\u65b0\u6570\u636e\u65f6\uff0c\u5c06\u66f4\u65b0\u64cd\u4f5c\uff08\u5373\u67d0\u4e2a\u6570\u636e\u9875\u4e0a\u505a\u4e86\u4ec0\u4e48\u4fee\u6539\uff09\u5148\u5199\u5230redo log\u91cc\u9762\uff0c\u7136\u540e\u66f4\u65b0\u5185\u5b58\uff0c\u8fd9\u4e2a\u66f4\u65b0\u64cd\u4f5c\u5c31\u7b97\u5b8c\u6210\u4e86\u3002MySQL\u4f1a\u5728\u670d\u52a1\u5668\u7a7a\u95f2\u7684\u65f6\u5019\uff0c\u628aredo log\u7684\u64cd\u4f5c\u8bb0\u5f55\u5237\u65b0\u5230\u78c1\u76d8\u91cc\uff0c\u4ee5\u4fdd\u6301\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002<\/span><\/p>\n<p style=\"text-align: justify\">\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0credo log\u867d\u7136\u4e5f\u662f\u78c1\u76d8\u4e0a\u7684\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u7531\u4e8e\u64cd\u4f5c\u662f\u987a\u5e8f\u5199\uff0c\u6240\u4ee5\u6027\u80fd\u662f\u975e\u5e38\u9ad8\u7684\u3002<\/p>\n<p style=\"text-align: justify\">\u5f53\u7136\u4e86\uff0credo log\u4e5f\u662f\u6709\u5927\u5c0f\u4e0a\u9650\u7684\uff0c\u4e0d\u53ef\u80fd\u65e0\u9650\u5236\u7684\u5199\u5165\u3002<\/p>\n<p style=\"text-align:center\">\n<p style=\"text-align: justify\">\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\u914d\u7f6e\u4e864\u4e2aredo log\uff0cwrite pos\u5c31\u662f\u4ee3\u8868\u5f53\u524d\u8bb0\u5f55\u5199\u5230\u4ec0\u4e48\u4f4d\u7f6e\u4e86\uff0c\u800ccheck point\u8868\u793a\u4e00\u4e2a\u63a8\u8fdb\u70b9\uff0c\u5b83\u4f1a\u4e0d\u65ad\u7684\u524d\u79fb\uff0c\u505a\u64e6\u9664\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u4ee5\u4fdd\u8bc1redo log\u53ef\u4ee5\u4e0d\u65ad\u7684\u5199\u5165\u3002<\/p>\n<p style=\"text-align: justify\">\u5f53\u7136\uff0c\u64e6\u9664\u6570\u636e\u4e4b\u524d\uff0c\u4f1a\u628aredo log\u7684\u8bb0\u5f55\u5237\u65b0\u5230\u78c1\u76d8\u3002<\/p>\n<p style=\"text-align: justify\">\u901a\u8fc7redo log\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u5373\u4f7fMySQL\u53d1\u751f\u5f02\u5e38\u91cd\u542f\uff0c\u6570\u636e\u4e5f\u4e0d\u4f1a\u4e22\u5931\uff08\u56e0\u4e3aredo log\u662f\u7269\u7406\u65e5\u5fd7\uff0c\u53ef\u4ee5\u8fdb\u884c\u91cd\u653e\uff09\uff0c\u8fd9\u4e2a\u7279\u6027\u5c31\u53eb\u505acrash-safe\u3002<\/p>\n<h2>bin log<\/h2>\n<p style=\"text-align: justify\">bin log\u662fMySQL Server\u63d0\u4f9b\u7684\u4e00\u79cd\u65e5\u5fd7\uff0c\u53eb\u505a\u5f52\u6863\u65e5\u5fd7\uff0c\u6240\u6709\u5f15\u64ce\u90fd\u53ef\u4ee5\u4f7f\u7528bin log\u3002<\/p>\n<p style=\"text-align: justify\"><span style=\"color: #ff5e5e\">\u90a3bin log\u548credo log\u7684\u533a\u522b\u662f\u4ec0\u4e48\u5462\uff1f<\/span><\/p>\n<p style=\"text-align: justify\">1\uff0c\u8fd9\u4e24\u79cd\u65e5\u5fd7\u7684\u63d0\u4f9b\u8005\u4e0d\u540c\uff1abin log\u662f\u7531MySQL Server\u63d0\u4f9b\u7684\uff0credo log\u662fInnoDB\u5f15\u64ce\u7279\u6709\u7684\u3002<\/p>\n<p style=\"text-align: justify\">2\uff0credo log\u4e3b\u8981\u8bb0\u5f55\u7684\u662f\u67d0\u4e2a\u6570\u636e\u9875\u505a\u4e86\u4ec0\u4e48\u4fee\u6539\uff0cbin log\u8bb0\u5f55\u7684\u662f\u8bed\u53e5\u7684\u539f\u59cb\u903b\u8f91\uff0c\u6bd4\u5982\u66f4\u65b0\u4e86\u67d0\u4e00\u884c\u7684\u67d0\u4e2a\u5b57\u6bb5\u3002<\/p>\n<p style=\"text-align: justify\">3\uff0credo log\u662f\u5faa\u73af\u5199\u7684\uff0c\u6570\u636e\u4f1a\u88ab\u8986\u76d6\u3002bin log\u662f\u8ffd\u52a0\u5199\uff0c\u4e00\u4e2a\u6587\u4ef6\u5199\u6ee1\uff0c\u5c31\u5199\u4e0b\u4e00\u4e2a\u6587\u4ef6\u3002<\/p>\n<h2>\u4e24\u9636\u6bb5\u63d0\u4ea4<\/h2>\n<p style=\"text-align: justify\">\u4ecb\u7ecd\u5b8c\u4e86redo log\u548cbin log\uff0c\u6211\u4eec\u518d\u770b\u4e00\u4e0b\u4ed6\u4eec\u4e24\u8005\u662f\u5982\u4f55\u914d\u5408\u5b8c\u6210\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u3002<\/p>\n<p style=\"text-align:center\">\n<p style=\"text-align: justify\">\u4e0a\u56fe\u5c31\u662f\u4e00\u4e2a\u66f4\u65b0\u6570\u636e\u7684\u6d41\u7a0b\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u66f4\u65b0\u4e00\u6761\u6570\u636e\u4e4b\u524d\uff0cMySQL\u4f1a\u5148\u5c06\u6570\u636e\u52a0\u8f7d\u5230\u5185\u5b58\uff0c\u7136\u540e\u66f4\u65b0\u5185\u5b58\uff0c\u5f00\u59cb\u5199redo log\u3002<\/p>\n<p style=\"text-align: justify\">\u6b64\u65f6\uff0credo log\u5904\u4e8eprepare\u72b6\u6001\uff0c\u7b49\u5230bin log\u5199\u5b8c\u4e4b\u540e\uff0c\u518d\u63d0\u4ea4\u4e8b\u52a1\uff0c\u8fd9\u4e00\u6761\u8bb0\u5f55\u7684\u66f4\u65b0\u64cd\u4f5c\u5c31\u7b97\u5b8c\u6210\u4e86\u3002<\/p>\n<p style=\"text-align: justify\">redo log prepare -&gt; \u5199bin log -&gt; redo log commit\uff0c\u8fd9\u4e2a\u6d41\u7a0b\u5c31\u53eb\u505a\u4e24\u9636\u6bb5\u63d0\u4ea4\u3002<\/p>\n<p style=\"text-align: justify\"><span style=\"color: #ff5e5e\">\u4e0b\u9762\u6211\u4eec\u5206\u6790\u4e00\u4e0b\uff0c\u91c7\u7528\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u597d\u5904\u3002<\/span><\/p>\n<p style=\"text-align: justify\">\u60c5\u666f\u4e00\uff0credo log\u5904\u4e8eprepare\u72b6\u6001\u65f6\uff0c\u5982\u679c\u5199bin log\u5931\u8d25\u4e86\uff0c\u90a3\u4e48\u66f4\u65b0\u5931\u8d25\uff0c\u6b64\u65f6redo log\u6ca1\u6709commit\uff0cbin log\u4e5f\u6ca1\u6709\u8bb0\u5f55\uff0c\u4e24\u8005\u7684\u72b6\u6001\u662f\u4e00\u81f4\u7684\uff0c\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n<p style=\"text-align: justify\">\u60c5\u666f\u4e8c\uff0credo log\u5904\u4e8eprepare\u72b6\u6001\u65f6\uff0c\u5199bin log\u6210\u529f\uff0c\u4f46\u662f\u5b95\u673a\u5bfc\u81f4commit\u5931\u8d25\u4e86\u3002\u6b64\u65f6bin log\u4ea7\u751f\u4e86\u8bb0\u5f55\uff0credo log\u6ca1\u6709\u5199\u5165\u6210\u529f\uff0c\u6570\u636e\u6682\u65f6\u4e0d\u4e00\u81f4\u3002<\/p>\n<p style=\"text-align: justify\">\u4f46\u662f\u4e0d\u7528\u62c5\u5fc3\uff0c\u5f53MySQL\u91cd\u542f\u65f6\uff0c\u4f1a\u68c0\u67e5redo log\u4e2d\u5904\u4e8eprepare\u72b6\u6001\u7684\u8bb0\u5f55\u3002\u5728redo log\u4e2d\uff0c\u8bb0\u5f55\u4e86\u4e00\u4e2a\u53eb\u505aXID\u7684\u5b57\u6bb5\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u5728bin log\u4e2d\u4e5f\u6709\u8bb0\u5f55\uff0cMySQL\u4f1a\u901a\u8fc7\u8fd9\u4e2aXID\uff0c\u5982\u679c\u5728bin log\u4e2d\u627e\u5230\u4e86\uff0c\u90a3\u4e48\u5c31commit\u8fd9\u4e2aredo log\uff0c\u5982\u679c\u6ca1\u6709\u627e\u5230\uff0c\u8bf4\u660ebin log\u5176\u5b9e\u6ca1\u6709\u5199\u6210\u529f\uff0c\u5c31\u653e\u5f03\u63d0\u4ea4\u3002<\/p>\n<p style=\"text-align: justify\">\u901a\u8fc7\u8fd9\u6837\u7684\u673a\u5236\uff0c\u4fdd\u8bc1\u4e86redo log\u548cbin log\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p style=\"text-align: justify\">\u4e4b\u6240\u4ee5MySQL\u4e2d\u65e2\u5b58\u5728redo log\uff0c\u53c8\u5b58\u5728bin log\uff0c\u8fd9\u662f\u56e0\u4e3abin log\u662fMySQL Server\u63d0\u4f9b\u7684\u4e00\u79cd\u5f52\u6863\u65e5\u5fd7\uff0c\u5176\u672c\u8eab\u5e76\u4e0d\u5177\u5907crash-safe\u80fd\u529b\u3002\u800credo log\u672c\u8eab\u4e0d\u5177\u5907\u5f52\u6863\u80fd\u529b\uff0c\u4ed6\u662f\u4e00\u79cd\u5faa\u73af\u5199\u7684\u65e5\u5fd7\u3002<\/p>\n<p style=\"text-align: justify\">MySQL\u901a\u8fc7\u5c06\u8fd9\u4e24\u79cd\u65e5\u5fd7\u6574\u5408\u8d77\u6765\uff0c\u5e76\u901a\u8fc7\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u673a\u5236\uff0c\u4fdd\u8bc1\u4e86\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 MySQL\u901a\u8fc7\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u673a\u5236\uff0c\u4fdd\u8bc1\u4e86redo log\u548cbin log\u7684\u903b\u8f91\u4e00\u81f4\u6027\uff0c\u8fdb\u800c\u4fdd\u8bc1\u4e86\u6570\u636e\u7684\u4e0d\u4e22 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":307094,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7038],"tags":[],"class_list":["post-307093","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/307093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=307093"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/307093\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/307094"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=307093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=307093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=307093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}