{"id":6422,"date":"2024-11-14T12:32:45","date_gmt":"2024-11-14T04:32:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6422\/"},"modified":"2024-11-14T12:32:45","modified_gmt":"2024-11-14T04:32:45","slug":"mysql%e4%b8%bb%e4%bb%8e%e5%bb%b6%e8%bf%9f%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6422\/","title":{"rendered":"mysql\u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"<blockquote><p>\n  mysql \u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u4f18\u5316 binlog \u683c\u5f0f\uff08mixed\uff09\u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f\u7981\u7528 binlog checksum\uff08\u4e0d\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\uff09\u4f7f\u7528\u5e76\u884c\u590d\u5236\u5347\u7ea7 mysql \u7248\u672c\u4f7f\u7528 semi-sync \u590d\u5236\u4f7f\u7528 group replication\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/02\/2024080207433836336.jpg\" class=\"aligncenter\" title=\"mysql\u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848\u63d2\u56fe\" alt=\"mysql\u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\uff0c\u4e3b\u4ece\u590d\u5236\u5ef6\u8fdf\u662f\u6307\u4e3b\u6570\u636e\u5e93\u548c\u4ece\u6570\u636e\u5e93\u4e4b\u95f4\u7684\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u65f6\u95f4\u5dee\u3002\u5f53\u5ef6\u8fdf\u8fc7\u5927\u65f6\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6216\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u89e3\u51b3 MySQL \u4e3b\u4ece\u5ef6\u8fdf\u7684\u51e0\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. \u68c0\u67e5\u7f51\u7edc\u8fde\u63a5<\/strong><\/p>\n<p>\u7f51\u7edc\u8fde\u63a5\u4e0d\u826f\u662f\u5bfc\u81f4\u5ef6\u8fdf\u7684\u4e00\u4e2a\u5e38\u89c1\u539f\u56e0\u3002\u68c0\u67e5\u4e3b\u4ece\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u7f51\u7edc\u8fde\u63a5\uff0c\u786e\u4fdd\u5176\u7a33\u5b9a\u4e14\u901f\u5ea6\u8f83\u5feb\u3002<\/p>\n<p><strong>2. \u4f18\u5316 binlog \u683c\u5f0f<\/strong><\/p>\n<p>binlog \u683c\u5f0f\u4f1a\u5f71\u54cd\u4e3b\u4ece\u5ef6\u8fdf\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528 row \u683c\u5f0f\uff0c\u5b83\u5c06\u6bcf\u884c\u66f4\u6539\u8bb0\u5f55\u5230 binlog \u4e2d\u3002\u5bf9\u4e8e\u5927\u578b\u4e8b\u52a1\uff0c\u8fd9\u4f1a\u4ea7\u751f\u5927\u91cf binlog \u4e8b\u4ef6\uff0c\u5bfc\u81f4\u5ef6\u8fdf\u3002\u53ef\u4ee5\u6539\u4e3a\u4f7f\u7528 mixed \u683c\u5f0f\uff0c\u5b83\u4ec5\u8bb0\u5f55\u8868\u7ed3\u6784\u548c\u4e3b\u952e\u66f4\u6539\u3002<\/p>\n<p><strong>3. \u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f<\/strong><\/p>\n<p>binlog \u7f13\u5b58\u662f\u5b58\u50a8\u5c1a\u672a\u5199\u5165\u78c1\u76d8\u7684 binlog \u4e8b\u4ef6\u7684\u7f13\u51b2\u533a\u3002\u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f\u53ef\u4ee5\u51cf\u5c11\u5199\u5165\u78c1\u76d8\u7684\u6b21\u6570\uff0c\u4ece\u800c\u964d\u4f4e\u5ef6\u8fdf\u3002<\/p>\n<p><strong>4. \u7981\u7528 binlog checksum<\/strong><\/p>\n<p>binlog checksum \u662f\u7528\u4e8e\u9a8c\u8bc1 binlog \u4e8b\u4ef6\u5b8c\u6574\u6027\u7684\u53ef\u9009\u7279\u6027\u3002\u7981\u7528\u8be5\u7279\u6027\u53ef\u4ee5\u63d0\u9ad8\u5199\u5165 binlog \u7684\u6027\u80fd\uff0c\u4ece\u800c\u964d\u4f4e\u5ef6\u8fdf\u3002\u4f46\u4e0d\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u7981\u7528\u6b64\u529f\u80fd\u3002<\/p>\n<p><strong>5. \u4f7f\u7528\u5e76\u884c\u590d\u5236<\/strong><\/p>\n<p>\u5e76\u884c\u590d\u5236\u5141\u8bb8\u4ece\u6570\u636e\u5e93\u540c\u65f6\u4ece\u591a\u4e2a IO \u7ebf\u7a0b\u63a5\u6536 binlog \u4e8b\u4ef6\u3002\u8fd9\u53ef\u4ee5\u663e\u7740\u964d\u4f4e\u5ef6\u8fdf\uff0c\u5c24\u5176\u662f\u5bf9\u4e8e\u5177\u6709\u5927\u91cf\u5e76\u53d1\u7684\u5199\u5165\u64cd\u4f5c\u7684\u6570\u636e\u5e93\u3002<\/p>\n<p><strong>6. \u5347\u7ea7 MySQL \u7248\u672c<\/strong><\/p>\n<p>\u8f83\u65b0\u7248\u672c\u7684 MySQL \u901a\u5e38\u5177\u6709\u6539\u8fdb\u7684\u590d\u5236\u529f\u80fd\uff0c\u8fd9\u53ef\u4ee5\u5e2e\u52a9\u964d\u4f4e\u5ef6\u8fdf\u3002\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u53ef\u4ee5\u89e3\u51b3\u4e0e\u65e7\u7248\u672c\u76f8\u5173\u7684\u95ee\u9898\u3002<\/p>\n<p><strong>7. \u4f7f\u7528 semi-sync \u590d\u5236<\/strong><\/p>\n<p>\u534a\u540c\u6b65\u590d\u5236\u662f\u4e00\u79cd\u590d\u5236\u6a21\u5f0f\uff0c\u5b83\u5f3a\u5236\u4ece\u6570\u636e\u5e93\u5728\u63a5\u6536 binlog \u4e8b\u4ef6\u540e\u7acb\u5373\u63d0\u4ea4\u4e8b\u52a1\u3002\u8fd9\u51e0\u4e4e\u6d88\u9664\u4e86\u4e3b\u4ece\u5ef6\u8fdf\uff0c\u4f46\u53ef\u80fd\u4f1a\u964d\u4f4e\u4e3b\u6570\u636e\u5e93\u7684\u6027\u80fd\u3002<\/p>\n<p><strong>8. \u4f7f\u7528 Group Replication<\/strong><\/p>\n<p>Group Replication \u662f\u4e00\u79cd\u591a\u4e3b\u590d\u5236\u62d3\u6251\uff0c\u6d88\u9664\u4e86\u5355\u70b9\u6545\u969c\u5e76\u964d\u4f4e\u4e86\u5ef6\u8fdf\u3002\u5b83\u9002\u5408\u5177\u6709\u9ad8\u53ef\u7528\u6027\u548c\u4f4e\u5ef6\u8fdf\u8981\u6c42\u7684\u9ad8\u541e\u5410\u91cf\u73af\u5883\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql \u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u4f18\u5316 binlog \u683c\u5f0f\uff08mixed\uff09\u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f\u7981\u7528 binlog checksum\uff08\u4e0d\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\uff09\u4f7f\u7528\u5e76\u884c\u590d\u5236\u5347\u7ea7 mysql \u7248\u672c\u4f7f\u7528 semi-sync \u590d\u5236\u4f7f\u7528 group replication MySQL \u4e3b\u4ece\u5ef6\u8fdf\u89e3\u51b3\u65b9\u6848 \u5728 MySQL \u4e2d\uff0c\u4e3b\u4ece\u590d\u5236\u5ef6\u8fdf\u662f\u6307\u4e3b\u6570\u636e\u5e93\u548c\u4ece\u6570\u636e\u5e93\u4e4b\u95f4\u7684\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u65f6\u95f4\u5dee\u3002\u5f53\u5ef6\u8fdf\u8fc7\u5927\u65f6\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6216\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u89e3\u51b3 MySQL \u4e3b\u4ece\u5ef6\u8fdf\u7684\u51e0\u79cd\u65b9\u6cd5\uff1a 1. \u68c0\u67e5\u7f51\u7edc\u8fde\u63a5 \u7f51\u7edc\u8fde\u63a5\u4e0d\u826f\u662f\u5bfc\u81f4\u5ef6\u8fdf\u7684\u4e00\u4e2a\u5e38\u89c1\u539f\u56e0\u3002\u68c0\u67e5\u4e3b\u4ece\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u7f51\u7edc\u8fde\u63a5\uff0c\u786e\u4fdd\u5176\u7a33\u5b9a\u4e14\u901f\u5ea6\u8f83\u5feb\u3002 2. \u4f18\u5316 binlog \u683c\u5f0f binlog \u683c\u5f0f\u4f1a\u5f71\u54cd\u4e3b\u4ece\u5ef6\u8fdf\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528 row \u683c\u5f0f\uff0c\u5b83\u5c06\u6bcf\u884c\u66f4\u6539\u8bb0\u5f55\u5230 binlog \u4e2d\u3002\u5bf9\u4e8e\u5927\u578b\u4e8b\u52a1\uff0c\u8fd9\u4f1a\u4ea7\u751f\u5927\u91cf binlog \u4e8b\u4ef6\uff0c\u5bfc\u81f4\u5ef6\u8fdf\u3002\u53ef\u4ee5\u6539\u4e3a\u4f7f\u7528 mixed \u683c\u5f0f\uff0c\u5b83\u4ec5\u8bb0\u5f55\u8868\u7ed3\u6784\u548c\u4e3b\u952e\u66f4\u6539\u3002 3. \u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f binlog \u7f13\u5b58\u662f\u5b58\u50a8\u5c1a\u672a\u5199\u5165\u78c1\u76d8\u7684 binlog \u4e8b\u4ef6\u7684\u7f13\u51b2\u533a\u3002\u589e\u52a0 binlog \u7f13\u5b58\u5927\u5c0f\u53ef\u4ee5\u51cf\u5c11\u5199\u5165\u78c1\u76d8\u7684\u6b21\u6570\uff0c\u4ece\u800c\u964d\u4f4e\u5ef6\u8fdf\u3002 4. \u7981\u7528 binlog checksum binlog checksum \u662f\u7528\u4e8e\u9a8c\u8bc1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6422","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6422"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6422\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}