{"id":2217,"date":"2022-03-29T15:03:06","date_gmt":"2022-03-29T07:03:06","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=2217"},"modified":"2022-03-29T15:03:06","modified_gmt":"2022-03-29T07:03:06","slug":"mysql-%e4%b8%ba%e4%bb%80%e4%b9%88%e9%9c%80%e8%a6%81%e4%b8%a4%e9%98%b6%e6%ae%b5%e6%8f%90%e4%ba%a4%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2022\/03\/29\/2217\/","title":{"rendered":"MySQL \u4e3a\u4ec0\u4e48\u9700\u8981\u4e24\u9636\u6bb5\u63d0\u4ea4\uff1f"},"content":{"rendered":"<div id=\"postspictures\" class=\"article-content\" data-v-5a466875=\"\">\n<div id=\"container\" class=\"container am-engine\" data-v-b8f34e46=\"\" data-element=\"root\" data-placeholder=\"\">\n<p data-id=\"pd157317-QXO2JA8c\">\u4e3a\u4ec0\u4e48\u8981\u4e24\u9636\u6bb5\u63d0\u4ea4?\u4e00\u9636\u6bb5\u63d0\u4ea4\u4e0d\u884c\u5417?<\/p>\n<p data-id=\"pd157317-R7J34IZf\">\u5c0f\u4f19\u4f34\u4eec\u77e5\u9053\uff0cMySQL \u4e2d\u7684\u4e8b\u52a1\u662f\u4e24\u9636\u6bb5\u63d0\u4ea4\uff0c\u6211\u4eec\u89c1\u5230\u7684\u5f88\u591a\u5206\u5e03\u5f0f\u4e8b\u52a1\u4e5f\u90fd\u662f\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\uff0c\u4f8b\u5982 Seata\uff0c\u90a3\u4e48\u4e3a\u4ec0\u4e48\u8981\u4e24\u9636\u6bb5\u63d0\u4ea4\u5462?\u4e00\u6b21\u76f4\u63a5\u63d0\u4ea4\u4e86\u4e0d\u884c\u5417?\u4eca\u5929\u6211\u4eec\u6765\u804a\u804a\u8fd9\u4e2a\u8bdd\u9898\u3002<\/p>\n<h2 id=\"hc9b0489-iVDHR7WH\" data-id=\"hc9b0489-iVDHR7WH\">1. \u4ec0\u4e48\u662f\u4e24\u9636\u6bb5\u63d0\u4ea4<\/h2>\n<h3 id=\"h26976cb-NWSdDef8\" data-id=\"h26976cb-NWSdDef8\">1.1 binlog \u4e0e redologbinlog<\/h3>\n<h4 id=\"h6e90be6-8ii3GUYi\" data-id=\"h6e90be6-8ii3GUYi\">binlog<\/h4>\n<p data-id=\"pd157317-JH0KXyJK\">\u6211\u4eec\u4e2d\u6587\u4e00\u822c\u79f0\u4f5c\u5f52\u6863\u65e5\u5fd7\uff0c\u5982\u679c\u5927\u5bb6\u770b\u8fc7\u677e\u54e5\u4e4b\u524d\u53d1\u7684 MySQL \u4e3b\u4ece\u642d\u5efa\uff0c\u5e94\u8be5\u5bf9\u8fd9\u4e2a\u65e5\u5fd7\u6709\u5370\u8c61\uff0c\u5f53\u6211\u4eec\u642d\u5efa MySQL \u4e3b\u4ece\u7684\u65f6\u5019\u5c31\u79bb\u4e0d\u5f00 binlog\u3002<\/p>\n<p data-id=\"pd157317-AnBQUK6Y\">binlog \u662f MySQL Server \u5c42\u7684\u65e5\u5fd7\uff0c\u800c\u4e0d\u662f\u5b58\u50a8\u5f15\u64ce\u81ea\u5e26\u7684\u65e5\u5fd7\uff0c\u5b83\u8bb0\u5f55\u4e86\u6240\u6709\u7684 DDL \u548c DML(\u4e0d\u5305\u542b\u6570\u636e\u67e5\u8be2\u8bed\u53e5)\u8bed\u53e5\uff0c\u800c\u4e14\u662f\u4ee5\u4e8b\u4ef6\u5f62\u5f0f\u8bb0\u5f55\uff0c\u8fd8\u5305\u542b\u8bed\u53e5\u6240\u6267\u884c\u7684\u6d88\u8017\u7684\u65f6\u95f4\u7b49\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a<\/p>\n<ul data-id=\"ucd67dc5-UilQ9eJI\">\n<li data-id=\"l20de63f-YVPCBN2a\">binlog \u662f\u4e00\u79cd\u903b\u8f91\u65e5\u5fd7\uff0c\u4ed6\u91cc\u8fb9\u6240\u8bb0\u5f55\u7684\u662f\u4e00\u6761 SQL \u8bed\u53e5\u7684\u539f\u59cb\u903b\u8f91\uff0c\u4f8b\u5982\u7ed9\u67d0\u4e00\u4e2a\u5b57\u6bb5 +1\uff0c\u6ce8\u610f\u8fd9\u4e2a\u533a\u522b\u4e8e redo log \u7684\u7269\u7406\u65e5\u5fd7(\u5728\u67d0\u4e2a\u6570\u636e\u9875\u4e0a\u505a\u4e86\u4ec0\u4e48\u4fee\u6539)\u3002<\/li>\n<li data-id=\"l20de63f-bfLNeOmn\">binlog \u6587\u4ef6\u5199\u6ee1\u540e\uff0c\u4f1a\u81ea\u52a8\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u7ee7\u7eed\u5199\uff0c\u800c\u4e0d\u4f1a\u8986\u76d6\u4ee5\u524d\u7684\u65e5\u5fd7\uff0c\u8fd9\u4e2a\u4e5f\u533a\u522b\u4e8e redo log\uff0credo log \u662f\u5faa\u73af\u5199\u5165\u7684\uff0c\u5373\u540e\u9762\u5199\u5165\u7684\u53ef\u80fd\u4f1a\u8986\u76d6\u524d\u9762\u5199\u5165\u7684\u3002<\/li>\n<li data-id=\"l20de63f-kbQCUS3D\">\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u5728\u914d\u7f6e binlog \u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u6307\u5b9a binlog \u6587\u4ef6\u7684\u6709\u6548\u671f\uff0c\u8fd9\u6837\u5728\u5230\u671f\u540e\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u81ea\u52a8\u5220\u9664\uff0c\u8fd9\u6837\u907f\u514d\u5360\u7528\u8f83\u591a\u5b58\u50a8\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n<p data-id=\"pd157317-7gLodjLD\">\u6839\u636e MySQL \u5b98\u65b9\u6587\u6863\u7684\u4ecb\u7ecd\uff0c\u5f00\u542f binlog \u4e4b\u540e\uff0c\u5927\u6982\u4f1a\u6709 1% \u7684\u6027\u80fd\u635f\u8017\uff0c\u4e0d\u8fc7\u8fd9\u8fd8\u662f\u53ef\u4ee5\u63a5\u53d7\u7684\uff0c\u4e00\u822c\u6765\u8bf4\uff0cbinlog \u6709\u4e24\u4e2a\u91cd\u8981\u7684\u4f7f\u7528\u573a\u666f\uff1a<\/p>\n<ul data-id=\"ucd67dc5-neBIfUdc\">\n<li data-id=\"l20de63f-sh6p7OAY\">MySQL \u4e3b\u4ece\u590d\u5236\u65f6\uff1a\u5728\u4e3b\u673a\u4e0a\u5f00\u542f binlog\uff0c\u4e3b\u673a\u5c06 binlog \u540c\u6b65\u7ed9\u4ece\u673a\uff0c\u4ece\u673a\u901a\u8fc7 binlog \u6765\u540c\u6b65\u6570\u636e\uff0c\u8fdb\u800c\u5b9e\u73b0\u4e3b\u673a\u548c\u4ece\u673a\u7684\u6570\u636e\u540c\u6b65\u3002<\/li>\n<li data-id=\"l20de63f-YHe2XKTn\">MySQL \u6570\u636e\u6062\u590d\uff0c\u901a\u8fc7\u4f7f\u7528 mysqlbinlog \u5de5\u5177\u518d\u7ed3\u5408 binlog \u6587\u4ef6\uff0c\u53ef\u4ee5\u5c06\u6570\u636e\u6062\u590d\u5230\u8fc7\u53bb\u7684\u67d0\u4e00\u65f6\u523b\u3002<\/li>\n<\/ul>\n<h4 id=\"h6e90be6-BBBcN1lQ\" data-id=\"h6e90be6-BBBcN1lQ\">redo log<\/h4>\n<p data-id=\"pd157317-S8Wl4fHt\">\u524d\u9762\u6211\u4eec\u8bf4\u7684 binlog \u662f MySQL \u81ea\u5df1\u63d0\u4f9b\u7684\uff0c\u5728 MySQL \u7684 server \u5c42\uff0c\u800c redo log \u5219\u4e0d\u662f MySQL \u63d0\u4f9b\u7684\uff0c\u662f\u5b58\u50a8\u5f15\u64ce InnoDB \u81ea\u5df1\u63d0\u4f9b\u7684\u3002\u6240\u4ee5\u5728 MySQL \u4e2d\u5c31\u5b58\u5728\u4e24\u7c7b\u65e5\u5fd7 binlog \u548c redo log\uff0c\u5b58\u5728\u4e24\u7c7b\u65e5\u5fd7\u65e2\u6709\u5386\u53f2\u539f\u56e0(InnoDB \u6700\u65e9\u4e0d\u662f MySQL \u5b98\u65b9\u5b58\u50a8\u5f15\u64ce)\u4e5f\u6709\u6280\u672f\u539f\u56e0\uff0c\u8fd9\u4e2a\u54b1\u4eec\u4ee5\u540e\u518d\u7ec6\u804a\u3002<\/p>\n<p data-id=\"pd157317-Un61Y9cm\">\u6211\u4eec\u90fd\u77e5\u9053\uff0c\u4e8b\u52a1\u7684\u56db\u5927\u7279\u6027\u91cc\u9762\u6709\u4e00\u4e2a\u662f\u6301\u4e45\u6027\uff0c\u5373\u53ea\u8981\u4e8b\u52a1\u63d0\u4ea4\u6210\u529f\uff0c\u90a3\u4e48\u5bf9\u6570\u636e\u5e93\u505a\u7684\u4fee\u6539\u5c31\u88ab\u6c38\u4e45\u4fdd\u5b58\u4e0b\u6765\u4e86\uff0c\u5199\u5230\u78c1\u76d8\u4e2d\u4e86\uff0c\u600e\u4e48\u505a\u5230\u7684\u5462?\u5176\u5b9e\u6211\u4eec\u5f88\u5bb9\u6613\u60f3\u5230\u662f\u5728\u6bcf\u6b21\u4e8b\u52a1\u63d0\u4ea4\u7684\u65f6\u5019\uff0c\u5c06\u8be5\u4e8b\u52a1\u6d89\u53ca\u4fee\u6539\u7684\u6570\u636e\u9875\u5168\u90e8\u5237\u65b0\u5230\u78c1\u76d8\u4e2d\uff0c\u4e00\u65e6\u5199\u5230\u78c1\u76d8\u4e2d\uff0c\u5c31\u4e0d\u6015\u6570\u636e\u4e22\u5931\u4e86\u3002<\/p>\n<p data-id=\"pd157317-6EJLoKxn\">\u4f46\u662f\u8981\u662f\u6bcf\u6b21\u90fd\u8fd9\u4e48\u641e\uff0c\u6570\u636e\u5e93\u5c31\u4e0d\u77e5\u9053\u6162\u5230\u54ea\u91cc\u53bb\u4e86!\u56e0\u4e3a Innodb \u662f\u4ee5\u9875\u4e3a\u5355\u4f4d\u8fdb\u884c\u78c1\u76d8\u4ea4\u4e92\u7684\uff0c\u800c\u4e00\u4e2a\u4e8b\u52a1\u5f88\u53ef\u80fd\u53ea\u4fee\u6539\u4e00\u4e2a\u6570\u636e\u9875\u91cc\u9762\u7684\u51e0\u4e2a\u5b57\u8282\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c06\u5b8c\u6574\u7684\u6570\u636e\u9875\u5237\u5230\u78c1\u76d8\u7684\u8bdd\uff0c\u4e0d\u4ec5\u6548\u7387\u4f4e\uff0c\u4e5f\u6d6a\u8d39\u8d44\u6e90\u3002\u6548\u7387\u4f4e\u662f\u56e0\u4e3a\u8fd9\u4e9b\u6570\u636e\u9875\u5728\u7269\u7406\u4e0a\u5e76\u4e0d\u8fde\u7eed\uff0c\u5c06\u6570\u636e\u9875\u5237\u5230\u78c1\u76d8\u4f1a\u6d89\u53ca\u5230\u968f\u673a IO\u3002<\/p>\n<p data-id=\"pd157317-kwAeZvcg\">\u6709\u9274\u4e8e\u6b64\uff0cMySQL \u8bbe\u8ba1\u4e86 redo log\uff0c\u5728 redo log \u4e2d\u53ea\u8bb0\u5f55\u4e8b\u52a1\u5bf9\u6570\u636e\u9875\u505a\u4e86\u54ea\u4e9b\u4fee\u6539\u3002\u90a3\u6709\u4eba\u8bf4\uff0c\u5199 redo log \u4e0d\u5c31\u662f\u78c1\u76d8 IO \u5417?\u800c\u5199\u6570\u636e\u5230\u78c1\u76d8\u4e5f\u662f\u78c1\u76d8 IO\uff0c\u65e2\u7136\u90fd\u662f\u78c1\u76d8 IO\uff0c\u90a3\u5e72\u561b\u4e0d\u628a\u76f4\u63a5\u628a\u6570\u636e\u5199\u5230\u78c1\u76d8\u5462?\u8fd8\u8d39\u8fd9\u4e8b!<\/p>\n<p data-id=\"pd157317-EFIWHFh6\">\u6b64\u8a00\u5dee\u77e3\u3002<\/p>\n<p data-id=\"pd157317-a9SSiaw8\">\u5199 redo log \u8ddf\u5199\u6570\u636e\u6709\u4e00\u4e2a\u5f88\u5927\u7684\u5dee\u5f02\uff0c\u90a3\u5c31\u662f redo log \u662f\u987a\u5e8f IO\uff0c\u800c\u5199\u6570\u636e\u6d89\u53ca\u5230\u968f\u673a IO\uff0c\u5199\u6570\u636e\u9700\u8981\u5bfb\u5740\uff0c\u627e\u5230\u5bf9\u5e94\u7684\u4f4d\u7f6e\uff0c\u7136\u540e\u66f4\u65b0\/\u6dfb\u52a0\/\u5220\u9664\uff0c\u800c\u5199 redo log \u5219\u662f\u5728\u4e00\u4e2a\u56fa\u5b9a\u7684\u4f4d\u7f6e\u5faa\u73af\u5199\u5165\uff0c\u662f\u987a\u5e8f IO\uff0c\u6240\u4ee5\u901f\u5ea6\u8981\u9ad8\u4e8e\u5199\u6570\u636e\u3002<\/p>\n<p data-id=\"pd157317-bOAxjSkc\">redo log \u672c\u8eab\u53c8\u5206\u4e3a\uff1a<\/p>\n<ul data-id=\"ucd67dc5-YFdnaQUJ\">\n<li data-id=\"l20de63f-PGUdFRLT\">\u65e5\u5fd7\u7f13\u51b2(redo log buffer)\uff0c\u8be5\u90e8\u5206\u65e5\u5fd7\u662f\u6613\u5931\u6027\u7684\u3002<\/li>\n<li data-id=\"l20de63f-INkYFUiU\">\u91cd\u505a\u65e5\u5fd7(redo log file)\uff0c\u8fd9\u662f\u78c1\u76d8\u4e0a\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u8be5\u90e8\u5206\u65e5\u5fd7\u662f\u6301\u4e45\u7684\u3002<\/li>\n<\/ul>\n<p data-id=\"pd157317-f3KNw4vK\">MySQL \u6bcf\u6267\u884c\u4e00\u6761 DML \u8bed\u53e5\uff0c\u5148\u5c06\u8bb0\u5f55\u5199\u5165 redo log buffer\uff0c\u540e\u7eed\u5728\u67d0\u4e2a\u65f6\u95f4\u70b9\u518d\u4e00\u6b21\u6027\u5c06\u591a\u4e2a\u64cd\u4f5c\u8bb0\u5f55\u5199\u5230 redo log file\uff0c\u8fd9\u79cd\u5148\u5199\u65e5\u5fd7\u518d\u5199\u78c1\u76d8\u7684\u6280\u672f\u5c31\u662f MySQL \u91cc\u7ecf\u5e38\u8bf4\u5230\u7684 WAL(Write-Ahead Logging) \u6280\u672f(\u9884\u5199\u65e5\u5fd7)\u3002<\/p>\n<h3 id=\"h26976cb-YGPkUdmO\" data-id=\"h26976cb-YGPkUdmO\">1.2 \u4e24\u9636\u6bb5\u63d0\u4ea4<\/h3>\n<p data-id=\"pd157317-MN7SVHWG\">\u5728 MySQL \u4e2d\uff0c\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u4e3b\u89d2\u5c31\u662f binlog \u548c redolog\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u4e24\u9636\u6bb5\u63d0\u4ea4\u7684\u6d41\u7a0b\u56fe\uff1a<\/p>\n<p data-id=\"pd157317-s5rrdzjV\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2220\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/uploads\/2022\/03\/b7041329815e0c1c77e2239700b01b11443c5d-205x300-1.png\" width=\"205\" height=\"300\" alt=\"\" \/><\/p>\n<p data-id=\"pd157317-0ld1pTo5\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u5728\u6700\u540e\u63d0\u4ea4\u4e8b\u52a1\u7684\u65f6\u5019\uff0c\u6709 3 \u4e2a\u6b65\u9aa4\uff1a<\/p>\n<ul data-id=\"ucd67dc5-j4CM3FbT\">\n<li data-id=\"l20de63f-YWDXHFJZ\">\u5199\u5165 redo log\uff0c\u5904\u4e8e prepare \u72b6\u6001\u3002<\/li>\n<li data-id=\"l20de63f-BcnhJKXM\">\u5199 binlog\u3002<\/li>\n<li data-id=\"l20de63f-ADn49Qmh\">\u4fee\u6539 redo log \u72b6\u6001\u53d8\u4e3a commit\u3002<\/li>\n<\/ul>\n<p data-id=\"pd157317-CIJgcen1\">\u7531\u4e8e redo log \u7684\u63d0\u4ea4\u5206\u4e3a prepare \u548c commit \u4e24\u4e2a\u9636\u6bb5\uff0c\u6240\u4ee5\u79f0\u4e4b\u4e3a\u4e24\u9636\u6bb5\u63d0\u4ea4\u3002<\/p>\n<h3 id=\"h26976cb-9EFbB2jK\" data-id=\"h26976cb-9EFbB2jK\">2. \u4e3a\u4ec0\u4e48\u9700\u8981\u4e24\u9636\u6bb5\u63d0\u4ea4<\/h3>\n<p data-id=\"pd157317-4EmwABOS\">\u5982\u679c\u6ca1\u6709\u4e24\u9636\u6bb5\u63d0\u4ea4\uff0c\u90a3\u4e48 binlog \u548c redolog \u7684\u63d0\u4ea4\uff0c\u65e0\u975e\u5c31\u662f\u4e24\u79cd\u5f62\u5f0f\uff1a<\/p>\n<ul data-id=\"ucd67dc5-G6LqnLlW\">\n<li data-id=\"l20de63f-EiDFgcvp\">\u5148\u5199 binlog \u518d\u5199 redolog\u3002<\/li>\n<li data-id=\"l20de63f-2rTutaye\">\u5148\u5199 redolog \u518d\u5199 binlog\u3002<\/li>\n<\/ul>\n<p data-id=\"pd157317-Q3LCpIbH\">\u8fd9\u4e24\u79cd\u60c5\u51b5\u6211\u4eec\u5206\u522b\u6765\u770b\u3002<\/p>\n<p data-id=\"pd157317-OTUNoNnl\">\u5047\u8bbe\u6211\u4eec\u8981\u5411\u8868\u4e2d\u63d2\u5165\u4e00\u6761\u8bb0\u5f55 R\uff0c\u5982\u679c\u662f\u5148\u5199 binlog \u518d\u5199 redolog\uff0c\u90a3\u4e48\u5047\u8bbe binlog \u5199\u5b8c\u540e\u5d29\u6e83\u4e86\uff0c\u6b64\u65f6 redolog \u8fd8\u6ca1\u5199\u3002\u90a3\u4e48\u91cd\u542f\u6062\u590d\u7684\u65f6\u5019\u5c31\u4f1a\u51fa\u95ee\u9898\uff1abinlog \u4e2d\u5df2\u7ecf\u6709 R \u7684\u8bb0\u5f55\u4e86\uff0c\u5f53\u4ece\u673a\u4ece\u4e3b\u673a\u540c\u6b65\u6570\u636e\u7684\u65f6\u5019\u6216\u8005\u6211\u4eec\u4f7f\u7528 binlog \u6062\u590d\u6570\u636e\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u540c\u6b65\u5230 R \u8fd9\u6761\u8bb0\u5f55;\u4f46\u662f redolog \u4e2d\u6ca1\u6709\u5173\u4e8e R \u7684\u8bb0\u5f55\uff0c\u6240\u4ee5\u5d29\u6e83\u6062\u590d\u4e4b\u540e\uff0c\u63d2\u5165 R \u8bb0\u5f55\u7684\u8fd9\u4e2a\u4e8b\u52a1\u662f\u65e0\u6548\u7684\uff0c\u5373\u6570\u636e\u5e93\u4e2d\u6ca1\u6709\u8be5\u884c\u8bb0\u5f55\uff0c\u8fd9\u5c31\u9020\u6210\u4e86\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n<p data-id=\"pd157317-3XVqxKzX\">\u76f8\u53cd\uff0c\u5047\u8bbe\u6211\u4eec\u8981\u5411\u8868\u4e2d\u63d2\u5165\u4e00\u6761\u8bb0\u5f55 R\uff0c\u5982\u679c\u662f\u5148\u5199 redolog \u518d\u5199 binlog\uff0c\u90a3\u4e48\u5047\u8bbe redolog \u5199\u5b8c\u540e\u5d29\u6e83\u4e86\uff0c\u6b64\u65f6 binlog \u8fd8\u6ca1\u5199\u3002\u90a3\u4e48\u91cd\u542f\u6062\u590d\u7684\u65f6\u5019\u4e5f\u4f1a\u51fa\u95ee\u9898\uff1aredolog \u4e2d\u5df2\u7ecf\u6709 R \u7684\u8bb0\u5f55\u4e86\uff0c\u6240\u4ee5\u5d29\u6e83\u6062\u590d\u4e4b\u540e\uff0c\u63d2\u5165 R \u8bb0\u5f55\u7684\u8fd9\u4e2a\u4e8b\u52a1\u662f\u6709\u6548\u7684\uff0c\u901a\u8fc7\u8be5\u8bb0\u5f55\u5c06\u6570\u636e\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d;\u4f46\u662f binlog \u4e2d\u8fd8\u6ca1\u6709\u5173\u4e8e R \u7684\u8bb0\u5f55\uff0c\u6240\u4ee5\u5f53\u4ece\u673a\u4ece\u4e3b\u673a\u540c\u6b65\u6570\u636e\u7684\u65f6\u5019\u6216\u8005\u6211\u4eec\u4f7f\u7528 binlog \u6062\u590d\u6570\u636e\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u4f1a\u540c\u6b65\u5230 R \u8fd9\u6761\u8bb0\u5f55\uff0c\u8fd9\u5c31\u9020\u6210\u4e86\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n<p data-id=\"pd157317-G1V3Nwr2\">\u90a3\u4e48\u6309\u7167\u524d\u9762\u8bf4\u7684\u4e24\u9636\u6bb5\u63d0\u4ea4\u5c31\u80fd\u89e3\u51b3\u95ee\u9898\u5417?<\/p>\n<p data-id=\"pd157317-sMaO6ecP\">\u6211\u4eec\u6765\u770b\u5982\u4e0b\u4e09\u79cd\u60c5\u51b5\uff1a<\/p>\n<p data-id=\"pd157317-ecYJsQh7\">\u60c5\u51b5\u4e00\uff1a\u4e00\u9636\u6bb5\u63d0\u4ea4\u4e4b\u540e\u5d29\u6e83\u4e86\uff0c\u5373\u5199\u5165 redo log\uff0c\u5904\u4e8e prepare \u72b6\u6001 \u7684\u65f6\u5019\u5d29\u6e83\u4e86\uff0c\u6b64\u65f6\uff1a<\/p>\n<p data-id=\"pd157317-w5LNQHYA\">\u7531\u4e8e binlog \u8fd8\u6ca1\u5199\uff0credo log \u5904\u4e8e prepare \u72b6\u6001\u8fd8\u6ca1\u63d0\u4ea4\uff0c\u6240\u4ee5\u5d29\u6e83\u6062\u590d\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u4e8b\u52a1\u4f1a\u56de\u6eda\uff0c\u6b64\u65f6 binlog \u8fd8\u6ca1\u5199\uff0c\u6240\u4ee5\u4e5f\u4e0d\u4f1a\u4f20\u5230\u5907\u5e93\u3002<\/p>\n<p data-id=\"pd157317-kBF24QSH\">\u60c5\u51b5\u4e8c\uff1a\u5047\u8bbe\u5199\u5b8c binlog \u4e4b\u540e\u5d29\u6e83\u4e86\uff0c\u6b64\u65f6\uff1a<\/p>\n<p data-id=\"pd157317-V9LeUBtO\">redolog \u4e2d\u7684\u65e5\u5fd7\u662f\u4e0d\u5b8c\u6574\u7684\uff0c\u5904\u4e8e prepare \u72b6\u6001\uff0c\u8fd8\u6ca1\u6709\u63d0\u4ea4\uff0c\u90a3\u4e48\u6062\u590d\u7684\u65f6\u5019\uff0c\u9996\u5148\u68c0\u67e5 binlog \u4e2d\u7684\u4e8b\u52a1\u662f\u5426\u5b58\u5728\u5e76\u4e14\u5b8c\u6574\uff0c\u5982\u679c\u5b58\u5728\u4e14\u5b8c\u6574\uff0c\u5219\u76f4\u63a5\u63d0\u4ea4\u4e8b\u52a1\uff0c\u5982\u679c\u4e0d\u5b58\u5728\u6216\u8005\u4e0d\u5b8c\u6574\uff0c\u5219\u56de\u6eda\u4e8b\u52a1\u3002<\/p>\n<p data-id=\"pd157317-sjMEbTU8\">\u60c5\u51b5\u4e09\uff1a\u5047\u8bbe redolog \u5904\u4e8e commit \u72b6\u6001\u7684\u65f6\u5019\u5d29\u6e83\u4e86\uff0c\u90a3\u4e48\u91cd\u542f\u540e\u7684\u5904\u7406\u65b9\u6848\u540c\u60c5\u51b5\u4e8c\u3002<\/p>\n<p data-id=\"pd157317-aNwhyA7l\">\u7531\u6b64\u53ef\u89c1\uff0c\u4e24\u9636\u6bb5\u63d0\u4ea4\u80fd\u591f\u786e\u4fdd\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<p data-id=\"pd157317-aNwhyA7l\">\u6765\u6e90\uff1a \u6c5f\u5357\u4e00\u70b9\u96e8<\/p>\n<\/div>\n<\/div>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2217\" class=\"pvc_stats total_only  \" data-element-id=\"2217\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u8981\u4e24\u9636\u6bb5\u63d0\u4ea4?\u4e00\u9636\u6bb5\u63d0\u4ea4\u4e0d\u884c\u5417? \u5c0f\u4f19\u4f34\u4eec\u77e5\u9053\uff0cMySQL \u4e2d\u7684\u4e8b\u52a1\u662f\u4e24\u9636\u6bb5\u63d0\u4ea4\uff0c\u6211\u4eec\u89c1\u5230\u7684\u5f88\u591a\u5206\u5e03\u5f0f\u4e8b [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2217\" class=\"pvc_stats total_only  \" data-element-id=\"2217\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":3,"featured_media":2220,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-2217","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-17"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/2217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=2217"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/2217\/revisions"}],"predecessor-version":[{"id":2221,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/2217\/revisions\/2221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/2220"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=2217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=2217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=2217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}