{"id":72655,"date":"2023-09-13T09:55:08","date_gmt":"2023-09-13T01:55:08","guid":{"rendered":"http:\/\/gulass.cn\/?p=72655"},"modified":"2023-09-13T09:55:08","modified_gmt":"2023-09-13T01:55:08","slug":"galera-cluster","status":"publish","type":"post","link":"https:\/\/gulass.cn\/galera-cluster.html","title":{"rendered":"\u4e00\u79cd\u65b0\u578b\u7684\u9ad8\u4e00\u81f4\u6027MySQL\u96c6\u7fa4\u67b6\u6784\uff1aGalera Cluster"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u4f55\u8c13Galera Cluster\uff1f\u5c31\u662f\u96c6\u6210\u4e86Galera\u63d2\u4ef6\u7684MySQL\u96c6\u7fa4\uff0c\u662f\u4e00\u79cd\u65b0\u578b\u7684\uff0c\u6570\u636e\u4e0d\u5171\u4eab\u7684\uff0c\u9ad8\u5ea6\u5197\u4f59\u7684\u9ad8\u53ef\u7528\u65b9\u6848\uff0c\u76ee\u524dGalera Cluster\u6709\u4e24\u4e2a\u7248\u672c\uff0c\u5206\u522b\u662fPercona Xtradb Cluster\u53caMariaDB Cluster\uff0c\u90fd\u662f\u57fa\u4e8eGalera\u7684\uff0c\u6240\u4ee5\u8fd9\u91cc\u90fd\u7edf\u79f0\u4e3aGalera Cluster\u4e86\uff0c\u56e0\u4e3aGalera\u672c\u8eab\u662f\u5177\u6709\u591a\u4e3b\u7279\u6027\u7684\uff0c\u6240\u4ee5Galera Cluster\u4e5f\u5c31\u662fmulti-master\u7684\u96c6\u7fa4\u67b6\u6784<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 1. \u4f55\u8c13Galera Cluster<\/strong><\/div>\n \u4f55\u8c13Galera Cluster\uff1f\u5c31\u662f\u96c6\u6210\u4e86Galera\u63d2\u4ef6\u7684MySQL\u96c6\u7fa4\uff0c\u662f\u4e00\u79cd\u65b0\u578b\u7684\uff0c\u6570\u636e\u4e0d\u5171\u4eab\u7684\uff0c\u9ad8\u5ea6\u5197\u4f59\u7684\u9ad8\u53ef\u7528\u65b9\u6848\uff0c\u76ee\u524dGalera Cluster\u6709\u4e24\u4e2a\u7248\u672c\uff0c\u5206\u522b\u662fPercona Xtradb Cluster\u53caMariaDB Cluster\uff0c\u90fd\u662f\u57fa\u4e8eGalera\u7684\uff0c\u6240\u4ee5\u8fd9\u91cc\u90fd\u7edf\u79f0\u4e3aGalera Cluster\u4e86\uff0c\u56e0\u4e3aGalera\u672c\u8eab\u662f\u5177\u6709\u591a\u4e3b\u7279\u6027\u7684\uff0c\u6240\u4ee5Galera Cluster\u4e5f\u5c31\u662fmulti-master\u7684\u96c6\u7fa4\u67b6\u6784\uff0c\u5982\u56fe1\u6240\u793a\uff1a<\/p>\n <\/p>\n \u56fe1 Galera Cluster\u67b6\u6784<\/p>\n \u56fe1\u4e2d\u6709\u4e09\u4e2a\u5b9e\u4f8b\uff0c\u7ec4\u6210\u4e86\u4e00\u4e2a\u96c6\u7fa4\uff0c\u800c\u8fd9\u4e09\u4e2a\u8282\u70b9\u4e0e\u666e\u901a\u7684\u4e3b\u4ece\u67b6\u6784\u4e0d\u540c\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u4f5c\u4e3a\u4e3b\u8282\u70b9\uff0c\u4e09\u4e2a\u8282\u70b9\u662f\u5bf9\u7b49\u7684\uff0c\u8fd9\u79cd\u4e00\u822c\u79f0\u4e3amulti-master\u67b6\u6784\uff0c\u5f53\u6709\u5ba2\u6237\u7aef\u8981\u5199\u5165\u6216\u8005\u8bfb\u53d6\u6570\u636e\u65f6\uff0c\u968f\u4fbf\u8fde\u63a5\u54ea\u4e2a\u5b9e\u4f8b\u90fd\u662f\u4e00\u6837\u7684\uff0c\u8bfb\u5230\u7684\u6570\u636e\u662f\u76f8\u540c\u7684\uff0c\u5199\u5165\u67d0\u4e00\u4e2a\u8282\u70b9\u4e4b\u540e\uff0c\u96c6\u7fa4\u81ea\u5df1\u4f1a\u5c06\u65b0\u6570\u636e\u540c\u6b65\u5230\u5176\u5b83\u8282\u70b9\u4e0a\u9762\uff0c\u8fd9\u79cd\u67b6\u6784\u4e0d\u5171\u4eab\u4efb\u4f55\u6570\u636e\uff0c\u662f\u4e00\u79cd\u9ad8\u5197\u4f59\u67b6\u6784\u3002<\/p>\n \u4e00\u822c\u7684\u4f7f\u7528\u65b9\u6cd5\u662f\uff0c\u5728\u8fd9\u4e2a\u96c6\u7fa4\u4e0a\u9762\uff0c\u518d\u642d\u5efa\u4e00\u4e2a\u4e2d\u95f4\u5c42\uff0c\u8fd9\u4e2a\u4e2d\u95f4\u5c42\u7684\u529f\u80fd\u5305\u62ec\u5efa\u7acb\u8fde\u63a5\u3001\u7ba1\u7406\u8fde\u63a5\u6c60\uff0c\u8d1f\u8d23\u4f7f\u4e09\u4e2a\u5b9e\u4f8b\u7684\u8d1f\u8f7d\u57fa\u672c\u5e73\u8861\uff0c\u8d1f\u8d23\u5728\u5ba2\u6237\u7aef\u4e0e\u5b9e\u4f8b\u7684\u8fde\u63a5\u65ad\u5f00\u4e4b\u540e\u91cd\u8fde\uff0c\u4e5f\u53ef\u4ee5\u8d1f\u8d23\u8bfb\u5199\u5206\u79bb\uff08\u5728\u673a\u5668\u6027\u80fd\u4e0d\u540c\u7684\u60c5\u51b5\u4e0b\u53ef\u4ee5\u505a\u8fd9\u6837\u7684\u4f18\u5316\uff09\u7b49\u7b49\uff0c\u4f7f\u7528\u8fd9\u4e2a\u4e2d\u95f4\u5c42\u4e4b\u540e\uff0c\u7531\u4e8e\u8fd9\u4e09\u4e2a\u5b9e\u4f8b\u7684\u67b6\u6784\u5728\u5ba2\u6237\u7aef\u65b9\u9762\u662f\u900f\u660e\u7684\uff0c\u5ba2\u6237\u7aef\u53ea\u9700\u8981\u6307\u5b9a\u8fd9\u4e2a\u96c6\u7fa4\u7684\u6570\u636e\u6e90\u5730\u5740\uff0c\u8fde\u63a5\u5230\u4e2d\u95f4\u5c42\u5373\u53ef\uff0c\u4e2d\u95f4\u5c42\u4f1a\u8d1f\u8d23\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u5b9e\u4f8b\u8fde\u63a5\u7684\u4f20\u9012\u5de5\u4f5c\uff0c\u7531\u4e8e\u8fd9\u4e2a\u67b6\u6784\u652f\u6301\u591a\u70b9\u5199\u5165\uff0c\u6240\u4ee5\u5b8c\u5168\u907f\u514d\u4e86\u4e3b\u4ece\u590d\u5236\u7ecf\u5e38\u51fa\u73b0\u7684\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\uff0c\u4ece\u800c\u53ef\u4ee5\u505a\u5230\u4e3b\u4ece\u8bfb\u5199\u5207\u6362\u7684\u9ad8\u5ea6\u4f18\u96c5\uff0c\u5728\u4e0d\u5f71\u54cd\u7528\u6237\u7684\u60c5\u51b5\u4e0b\uff0c\u79bb\u7ebf\u7ef4\u62a4\u7b49\u5de5\u4f5c\uff0cMySQL\u7684\u9ad8\u53ef\u7528\uff0c\u4ece\u6b64\u5f00\u59cb\uff0c\u975e\u5e38\u5b8c\u7f8e\u3002<\/p>\n 2. \u4e3a\u4ec0\u4e48\u9700\u8981Galera Cluster<\/strong><\/div>\n MySQL\u5728\u4e92\u8054\u7f51\u65f6\u4ee3\uff0c\u53ef\u8c13\u662f\u6df1\u53d7\u4e16\u4eba\u77a9\u76ee\u7684\u3002\u7ed9\u793e\u4f1a\u521b\u9020\u4e86\u65e0\u9650\u4ef7\u503c\uff0c\u968f\u4e4b\u800c\u6765\u7684\u662f\uff0c\u5728MySQL\u57fa\u7840\u4e4b\u4e0a\uff0c\u4ea7\u751f\u4e86\u5f62\u5f62\u8272\u8272\u7684\u4f7f\u7528\u65b9\u6cd5\u3001\u67b6\u6784\u53ca\u5468\u8fb9\u4ea7\u54c1\u3002\u672c\u6587\u6240\u5173\u6ce8\u7684\u662f\u67b6\u6784\uff0c\u5728\u8fd9\u65b9\u9762\uff0c\u5df2\u7ecf\u6709\u5f88\u591a\u6210\u719f\u7684\u88ab\u4eba\u719f\u77e5\u7684\u4ea7\u54c1\uff0c\u6bd4\u5982MHA\u3001MMM\u7b49\u4f20\u7edf\u7ec4\u7ec7\u67b6\u6784\uff0c\u800c\u8fd9\u4e9b\u67b6\u6784\u662f\u6bcf\u4e2a\u9700\u8981\u6570\u636e\u5e93\u9ad8\u53ef\u7528\u670d\u52a1\u65b9\u6848\u7684\u5165\u95e8\u5fc5\u5907\u9009\u578b\u3002<\/p>\n \u4e0d\u5e78\u7684\u662f\uff0c\u4f20\u7edf\u67b6\u6784\u7684\u4f7f\u7528\uff0c\u4e00\u76f4\u88ab\u4eba\u4eec\u6240\u8bdf\u75c5\uff0c\u56e0\u4e3aMySQL\u7684\u4e3b\u4ece\u6a21\u5f0f\uff0c\u5929\u751f\u7684\u4e0d\u80fd\u5b8c\u5168\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\uff0c\u5f88\u591a\u5927\u516c\u53f8\u4f1a\u82b1\u5f88\u5927\u4eba\u529b\u7269\u529b\u53bb\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u800c\u6548\u679c\u5374\u4e00\u822c\uff0c\u53ef\u4ee5\u8bf4\uff0c\u53ea\u80fd\u662f\u901a\u8fc7\u727a\u7272\u6027\u80fd\uff0c\u6765\u83b7\u5f97\u6570\u636e\u4e00\u81f4\u6027\uff0c\u4f46\u4e5f\u53ea\u662f\u5728\u964d\u4f4e\u6570\u636e\u4e0d\u4e00\u81f4\u6027\u7684\u53ef\u80fd\u6027\u800c\u5df2\u3002\u6240\u4ee5\u73b0\u5728\u5c31\u6025\u9700\u4e00\u79cd\u65b0\u578b\u67b6\u6784\uff0c\u4ece\u6839\u672c\u4e0a\u89e3\u51b3\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u5929\u751f\u7684\u6446\u8131\u6389\u4e3b\u4ece\u590d\u5236\u6a21\u5f0f\u8fd9\u6837\u7684\u201c\u7f8e\u4e2d\u4e0d\u8db3\u201d\u4e4b\u5904\u4e86\u3002<\/p>\n \u5e78\u8fd0\u7684\u662f\uff0cMySQL\u7684\u798f\u97f3\u6765\u4e86\uff0cGalera Cluster\u5c31\u662f\u6211\u4eec\u9700\u8981\u7684\u2014\u2014\u4ece\u6b64\u53d8\u5f97\u5b8c\u7f8e\u7684\u67b6\u6784\u3002<\/p>\n \u76f8\u6bd4\u4f20\u7edf\u7684\u4e3b\u4ece\u590d\u5236\u67b6\u6784\uff0cGalera Cluster\u89e3\u51b3\u7684\u6700\u6838\u5fc3\u95ee\u9898\u662f\uff0c\u5728\u4e09\u4e2a\u5b9e\u4f8b\uff08\u8282\u70b9\uff09\u4e4b\u95f4\uff0c\u5b83\u4eec\u7684\u5173\u7cfb\u662f\u5bf9\u7b49\u7684\uff0cmulti-master\u67b6\u6784\u7684\uff0c\u5728\u591a\u8282\u70b9\u540c\u65f6\u5199\u5165\u7684\u65f6\u5019\uff0c\u80fd\u591f\u4fdd\u8bc1\u6574\u4e2a\u96c6\u7fa4\u6570\u636e\u7684\u4e00\u81f4\u6027\uff0c\u5b8c\u6574\u6027\u4e0e\u6b63\u786e\u6027\u3002<\/p>\n \u5728\u4f20\u7edfMySQL\u7684\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u4e5f\u4e0d\u96be\u5b9e\u73b0\u4e00\u79cdmulti-master\u67b6\u6784\uff0c\u4f46\u662f\u4e00\u822c\u9700\u8981\u4e0a\u5c42\u5e94\u7528\u6765\u914d\u5408\uff0c\u6bd4\u5982\u5148\u8981\u7ea6\u5b9a\u6bcf\u4e2a\u8868\u5fc5\u987b\u8981\u6709\u81ea\u589e\u5217\uff0c\u5e76\u4e14\u5982\u679c\u662f2\u4e2a\u8282\u70b9\u7684\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a\u8282\u70b9\u53ea\u80fd\u5199\u5076\u6570\u7684\u503c\uff0c\u800c\u53e6\u4e00\u4e2a\u8282\u70b9\u53ea\u80fd\u5199\u5947\u6570\u7684\u503c\uff0c\u540c\u65f62\u4e2a\u8282\u70b9\u4e4b\u95f4\u4e92\u76f8\u505a\u590d\u5236\uff0c\u56e0\u4e3a2\u4e2a\u8282\u70b9\u5199\u5165\u7684\u4e1c\u897f\u4e0d\u540c\uff0c\u6240\u4ee5\u590d\u5236\u4e0d\u4f1a\u51b2\u7a81\uff0c\u5728\u8fd9\u79cd\u7ea6\u5b9a\u4e4b\u4e0b\uff0c\u53ef\u4ee5\u57fa\u672c\u5b9e\u73b0\u591amaster\u7684\u67b6\u6784\uff0c\u4e5f\u53ef\u4ee5\u4fdd\u8bc1\u6570\u636e\u7684\u5b8c\u6574\u6027\u4e0e\u4e00\u81f4\u6027\u3002\u4f46\u8fd9\u79cd\u65b9\u5f0f\u4f7f\u7528\u8d77\u6765\u8fd8\u662f\u6709\u9650\u5236\uff0c\u540c\u65f6\u8fd8\u4f1a\u51fa\u73b0\u590d\u5236\u5ef6\u8fdf\uff0c\u5e76\u4e14\u4e0d\u5177\u6709\u6269\u5c55\u6027\uff0c\u4e0d\u662f\u771f\u6b63\u610f\u4e49\u4e0a\u7684\u96c6\u7fa4\u3002<\/p>\n 3. Galera Cluster\u5982\u4f55\u89e3\u51b3\u95ee\u9898<\/strong><\/div>\n 3.1 Galera\u7684\u5f15\u5165<\/strong><\/span><\/div>\n \u73b0\u5728\u5df2\u7ecf\u77e5\u9053\uff0cGalera Cluster\u662fMySQL\u5c01\u88c5\u4e86\u5177\u6709\u9ad8\u4e00\u81f4\u6027\uff0c\u652f\u6301\u591a\u70b9\u5199\u5165\u7684\u540c\u6b65\u901a\u4fe1\u6a21\u5757Galera\u800c\u505a\u7684\uff0c\u5b83\u662f\u5efa\u7acb\u5728MySQL\u540c\u6b65\u57fa\u7840\u4e4b\u4e0a\u7684\uff0c\u4f7f\u7528Galera Cluster\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u76f4\u63a5\u8bfb\u3001\u5199\u67d0\u4e2a\u8282\u70b9\u7684\u6700\u65b0\u6570\u636e\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u4e0d\u5f71\u54cd\u5e94\u7528\u7a0b\u5e8f\u8bfb\u5199\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0b\u7ebf\u67d0\u4e2a\u8282\u70b9\uff0c\u56e0\u4e3a\u652f\u6301\u591a\u70b9\u5199\u5165\uff0c\u4f7f\u5f97Failover\u53d8\u5f97\u975e\u5e38\u7b80\u5355\u3002<\/p>\n \u6240\u6709\u7684Galera Cluster\uff0c\u90fd\u662f\u5bf9Galera\u6240\u63d0\u4f9b\u7684\u63a5\u53e3API\u505a\u4e86\u5c01\u88c5\uff0c\u8fd9\u4e9bAPI\u4e3a\u4e0a\u5c42\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u72b6\u6001\u4fe1\u606f\u53ca\u56de\u8c03\u51fd\u6570\uff0c\u901a\u8fc7\u8fd9\u4e9b\u56de\u8c03\u51fd\u6570\uff0c\u505a\u5230\u4e86\u771f\u6b63\u7684\u591a\u4e3b\u96c6\u7fa4\uff0c\u591a\u70b9\u5199\u5165\u53ca\u540c\u6b65\u590d\u5236\uff0c\u8fd9\u4e9bAPI\u88ab\u79f0\u4f5c\u662fWrite-Set Replication API\uff0c\u7b80\u79f0\u4e3awsrep API\u3002<\/p>\n \u901a\u8fc7\u8fd9\u4e9bAPI\uff0cGalera Cluster\u63d0\u4f9b\u4e86\u57fa\u4e8e\u9a8c\u8bc1\u7684\u590d\u5236\uff0c\u662f\u4e00\u79cd\u4e50\u89c2\u7684\u540c\u6b65\u590d\u5236\u673a\u5236\uff0c\u4e00\u4e2a\u5c06\u8981\u88ab\u590d\u5236\u7684\u4e8b\u52a1\uff08\u79f0\u4e3a\u5199\u96c6\uff09\uff0c\u4e0d\u4ec5\u5305\u62ec\u88ab\u4fee\u6539\u7684\u6570\u636e\u5e93\u884c\uff0c\u8fd8\u5305\u62ec\u4e86\u8fd9\u4e2a\u4e8b\u52a1\u4ea7\u751f\u7684\u6240\u6709Binlog\uff0c\u6bcf\u4e00\u4e2a\u8282\u70b9\u5728\u590d\u5236\u4e8b\u52a1\u65f6\uff0c\u90fd\u4f1a\u62ff\u8fd9\u4e9b\u5199\u96c6\u4e0e\u6b63\u5728APPLY\u961f\u5217\u7684\u5199\u96c6\u505a\u6bd4\u5bf9\uff0c\u5982\u679c\u6ca1\u6709\u51b2\u7a81\u7684\u8bdd\uff0c\u8fd9\u4e2a\u4e8b\u52a1\u5c31\u53ef\u4ee5\u7ee7\u7eed\u63d0\u4ea4\uff0c\u6216\u8005\u662fAPPLY\uff0c\u8fd9\u4e2a\u65f6\u5019\uff0c\u8fd9\u4e2a\u4e8b\u52a1\u5c31\u88ab\u8ba4\u4e3a\u662f\u63d0\u4ea4\u4e86\uff0c\u7136\u540e\u5728\u6570\u636e\u5e93\u5c42\u9762\uff0c\u8fd8\u9700\u8981\u7ee7\u7eed\u505a\u4e8b\u52a1\u4e0a\u7684\u63d0\u4ea4\u64cd\u4f5c\u3002<\/p>\n \u8fd9\u79cd\u65b9\u5f0f\u7684\u590d\u5236\uff0c\u4e5f\u88ab\u79f0\u4e3a\u662f\u865a\u62df\u540c\u6b65\u590d\u5236\uff0c\u5b9e\u9645\u4e0a\u662f\u4e00\u79cd\u903b\u8f91\u4e0a\u7684\u540c\u6b65\uff0c\u56e0\u4e3a\u6bcf\u4e2a\u8282\u70b9\u7684\u5199\u5165\u548c\u63d0\u4ea4\u64cd\u4f5c\u8fd8\u662f\u72ec\u7acb\u7684\uff0c\u66f4\u51c6\u786e\u7684\u8bf4\u662f\u5f02\u6b65\u7684\uff0cGalera Cluster\u662f\u5efa\u7acb\u5728\u4e00\u79cd\u4e50\u89c2\u590d\u5236\u7684\u57fa\u7840\u4e0a\u7684\uff0c\u5047\u8bbe\u96c6\u7fa4\u4e2d\u7684\u6bcf\u4e2a\u8282\u70b9\u90fd\u662f\u540c\u6b65\u7684\uff0c\u90a3\u4e48\u52a0\u4e0a\u5728\u5199\u5165\u65f6\uff0c\u90fd\u4f1a\u505a\u9a8c\u8bc1\uff0c\u90a3\u4e48\u7406\u8bba\u4e0a\u662f\u4e0d\u4f1a\u51fa\u73b0\u4e0d\u4e00\u81f4\u7684\uff0c\u5f53\u7136\u4e5f\u4e0d\u80fd\u8fd9\u4e48\u4e50\u89c2\uff0c\u5982\u679c\u51fa\u73b0\u4e0d\u4e00\u81f4\u4e86\uff0c\u6bd4\u5982\u4e3b\u5e93\uff08\u76f8\u5bf9\uff09\u63d2\u5165\u6210\u529f\uff0c\u800c\u4ece\u5e93\u5219\u51fa\u73b0\u4e3b\u952e\u51b2\u7a81\uff0c\u90a3\u8bf4\u660e\u6b64\u65f6\u6570\u636e\u5e93\u5df2\u7ecf\u4e0d\u4e00\u81f4\uff0c\u8fd9\u79cd\u65f6\u5019Galera Cluster\u91c7\u53d6\u7684\u65b9\u5f0f\u662f\u5c06\u51fa\u73b0\u4e0d\u4e00\u81f4\u6570\u636e\u7684\u8282\u70b9\u8e22\u51fa\u96c6\u7fa4\uff0c\u5176\u5b9e\u662f\u81ea\u5df1shutdown\u4e86\u3002<\/p>\n \u800c\u901a\u8fc7\u4f7f\u7528Galera\uff0c\u5b83\u5728\u91cc\u9762\u901a\u8fc7\u5224\u65ad\u952e\u503c\u7684\u51b2\u7a81\u65b9\u5f0f\u5b9e\u73b0\u4e86\u771f\u6b63\u610f\u4e49\u4e0a\u7684multi-master\uff0cGalera Cluster\u5728MySQL\u751f\u6001\u4e2d\uff0c\u5728\u9ad8\u53ef\u7528\u65b9\u9762\u5b9e\u73b0\u4e86\u975e\u5e38\u91cd\u8981\u7684\u63d0\u5347\uff0c\u76ee\u524dGalera Cluster\u5177\u5907\u7684\u529f\u80fd\u5305\u62ec\u5982\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n \u591a\u4e3b\u67b6\u6784\uff1a\u771f\u6b63\u7684\u591a\u70b9\u8bfb\u5199\u7684\u96c6\u7fa4\uff0c\u5728\u4efb\u4f55\u65f6\u5019\u8bfb\u5199\u6570\u636e\uff0c\u90fd\u662f\u6700\u65b0\u7684\u3002 \u76ee\u524d\u719f\u77e5\u7684\u4e00\u4e9b\u7279\u6027\uff0c\u6216\u8005\u5728\u8fd0\u7ef4\u4e2d\u9700\u8981\u6ce8\u610f\u7684\u4e00\u4e9b\u7279\u6027\uff0c\u6709\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n Galera Cluster\u5199\u96c6\u5185\u5bb9\uff1aGalera Cluster\u590d\u5236\u7684\u65b9\u5f0f\uff0c\u8fd8\u662f\u57fa\u4e8eBinlog\u7684\uff0c\u8fd9\u4e2a\u95ee\u9898\uff0c\u4e5f\u662f\u4e00\u76f4\u88ab\u4eba\u7ea0\u7ed3\u7684\uff0c\u56e0\u4e3a\u76ee\u524dPercona Xtradb Cluster\u6240\u5b9e\u73b0\u7684\u7248\u672c\u4e2d\uff0c\u5728\u5c06Binlog\u5173\u6389\u4e4b\u540e\uff0c\u8fd8\u662f\u53ef\u4ee5\u4f7f\u7528\u7684\uff0c\u8fd9\u8bef\u5bfc\u4e86\u5f88\u591a\u4eba\uff0c\u5176\u5b9e\u5173\u6389\u4e4b\u540e\uff0c\u53ea\u662f\u4e0d\u843d\u5730\u4e86\uff0c\u8868\u8c61\u4e0a\u770b\u4e0a\u53bb\u662f\u6ca1\u6709\u4f7f\u7528Binlog\u4e86\uff0c\u5b9e\u9645\u4e0a\u5728\u5185\u90e8\u8fd8\u662f\u6084\u6084\u7684\u6253\u5f00\u4e86\u7684\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u5199\u96c6\u4e2d\u8fd8\u5305\u62ec\u4e86\u4e8b\u52a1\u5f71\u54cd\u7684\u6240\u6709\u884c\u7684\u4e3b\u952e\uff0c\u6240\u6709\u4e3b\u952e\u7ec4\u6210\u4e86\u5199\u96c6\u7684KEY\uff0c\u800cBinlog\u7ec4\u6210\u4e86\u5199\u96c6\u7684DATA\uff0c\u8fd9\u6837\u4e00\u4e2aKEY-DATA\u5c31\u662f\u5199\u96c6\u3002KEY\u548cDATA\u5206\u522b\u5177\u6709\u4e0d\u540c\u7684\u4f5c\u7528\u7684\uff0cKEY\u662f\u7528\u6765\u9a8c\u8bc1\u7684\uff0c\u9a8c\u8bc1\u4e0e\u5176\u5b83\u4e8b\u52a1\u6ca1\u6709\u51b2\u7a81\uff0c\u800cDATA\u662f\u7528\u6765\u5728\u9a8c\u8bc1\u901a\u8fc7\u4e4b\u540e\uff0c\u505aAPPLY\u7684\u3002 <\/p>\n \u56fe2 galera\u539f\u7406\u56fe<\/p>\n \u56fe2\u662f\u4ece\u5b98\u65b9\u624b\u518c\u4e2d\u622a\u53d6\u7684\uff0c\u4ece\u56fe\u4e2d\u53ef\u4ee5\u5927\u6982\u770b\u51fa\uff0c\u4ece\u4e8b\u52a1\u6267\u884c\u5f00\u59cb\uff0c\u5230\u672c\u5730\u6267\u884c\uff0c\u518d\u5230\u5199\u96c6\u53d1\u9001\uff0c\u518d\u5230\u5199\u96c6\u9a8c\u8bc1\uff0c\u518d\u5230\u5199\u96c6\u63d0\u4ea4\u7684\u6574\u4e2a\u8fc7\u7a0b\uff0c\u4ee5\u53ca\u4ece\u8282\u70b9\uff08\u76f8\u5bf9\uff09\u6536\u5230\u5199\u96c6\u4e4b\u540e\uff0c\u6240\u505a\u7684\u5199\u96c6\u9a8c\u8bc1\u3001\u5199\u96c6APPLY\u53ca\u5199\u96c6\u63d0\u4ea4\u64cd\u4f5c\uff0c\u901a\u8fc7\u5bf9\u6bd4\u8fd9\u4e2a\u56fe\uff0c\u53ef\u4ee5\u5f88\u597d\u7684\u7406\u89e3\u6bcf\u4e00\u4e2a\u9636\u6bb5\u7684\u610f\u4e49\u53ca\u6027\u80fd\u7b49\uff0c\u4e0b\u9762\u5c31\u6bcf\u4e00\u4e2a\u9636\u6bb5\u4ee5\u53ca\u5176\u5e76\u53d1\u63a7\u5236\u884c\u4e3a\u505a\u4e00\u4e2a\u7b80\u5355\u7684\u4ecb\u7ecd\uff1a b. \u5199\u96c6\u53d1\u9001\uff1a\u5728\u6267\u884c\u5b8c\u4e4b\u540e\uff0c\u5c31\u5230\u4e86\u63d0\u4ea4\u9636\u6bb5\uff0c\u63d0\u4ea4\u4e4b\u524d\u9996\u5148\u5c06\u4ea7\u751f\u7684\u5199\u96c6\u5e7f\u64ad\u51fa\u53bb\uff0c\u800c\u4e3a\u4e86\u4fdd\u8bc1\u5168\u5c40\u6570\u636e\u7684\u4e00\u81f4\u6027\uff0c\u5728\u5199\u96c6\u53d1\u9001\u65f6\uff0c\u9700\u8981\u4e32\u884c\uff0c\u8fd9\u4e2a\u5c31\u5c5e\u4e8eGalera Cluster\u5e76\u53d1\u63a7\u5236\u7684\u4e00\u90e8\u5206\u4e86\u3002<\/p>\n c. \u5199\u96c6\u9a8c\u8bc1\uff1a\u8fd9\u4e2a\u9636\u6bb5\uff0c\u5c31\u662f\u6211\u4eec\u901a\u5e38\u8bf4\u7684Galera Cluster\u7684\u9a8c\u8bc1\u4e86\uff0c\u9a8c\u8bc1\u662f\u5c06\u5f53\u524d\u7684\u4e8b\u52a1\uff0c\u4e0e\u672c\u5730\u5199\u96c6\u9a8c\u8bc1\u7f13\u5b58\u96c6\u6765\u505a\u9a8c\u8bc1\uff0c\u901a\u8fc7\u6bd4\u5bf9\u5199\u96c6\u4e2d\u88ab\u5f71\u54cd\u7684\u6570\u636e\u5e93KEYS\uff0c\u6765\u53d1\u73b0\u6709\u6ca1\u6709\u76f8\u540c\u7684\uff0c\u6765\u786e\u5b9a\u662f\u4e0d\u662f\u53ef\u4ee5\u9a8c\u8bc1\u901a\u8fc7\uff0c\u90a3\u4e48\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u4e5f\u662f\u4e32\u884c\u7684\u3002<\/p>\n d. \u5199\u96c6\u63d0\u4ea4\uff1a\u8fd9\u4e2a\u9636\u6bb5\uff0c\u662f\u4e00\u4e2a\u4e8b\u52a1\u6267\u884c\u65f6\u7684\u6700\u540e\u4e00\u4e2a\u9636\u6bb5\u4e86\uff0c\u9a8c\u8bc1\u5b8c\u6210\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u8fdb\u5165\u63d0\u4ea4\u9636\u6bb5\u4e86\uff0c\u56e0\u4e3a\u4e9b\u65f6\u5df2\u7ecf\u6267\u884c\u5b8c\u4e86\u7684\uff0c\u800c\u63d0\u4ea4\u64cd\u4f5c\u7684\u5e76\u53d1\u63a7\u5236\uff0c\u662f\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6765\u63a7\u5236\u5176\u884c\u4e3a\u7684\uff0c\u5373\u53c2\u6570repl.commit_order\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3a3\uff0c\u8868\u793a\u63d0\u4ea4\u5c31\u662f\u4e32\u884c\u7684\u4e86\uff0c\u800c\u8fd9\u4e5f\u662f\u672c\u4eba\u6240\u63a8\u8350\u7684\uff08\u9ed8\u8ba4\u503c\uff09\u7684\u4e00\u79cd\u8bbe\u7f6e\uff0c\u56e0\u4e3a\u8fd9\u6837\u7684\u7ed3\u679c\u662f\uff0c\u96c6\u7fa4\u4e2d\u4e0d\u540c\u8282\u70b9\u4ea7\u751f\u7684Binlog\u662f\u5b8c\u5168\u4e00\u6837\u7684\uff0c\u8fd0\u7ef4\u4e2d\u5e26\u6765\u4e86\u4e0d\u5c11\u597d\u5904\u548c\u65b9\u4fbf\u3002\u5176\u5b83\u503c\u7684\u89e3\u91ca\uff0c\u4ee5\u540e\u6709\u673a\u4f1a\u518d\u505a\u8bb2\u89e3\u3002<\/p>\n e. \u5199\u96c6APPLY\uff1a\u8fd9\u4e2a\u9636\u6bb5\uff0c\u4e0e\u4e0a\u9762\u7684\u51e0\u4e2a\u5728\u6d41\u7a0b\u4e0a\u4e0d\u592a\u4e00\u6837\uff0c\u8fd9\u4e2a\u9636\u6bb5\u662f\u4ece\u8282\u70b9\u505a\u7684\u4e8b\u60c5\uff0c\u4ece\u8282\u70b9\u53ea\u5305\u62ec\u4e24\u4e2a\u9636\u6bb5\uff0c\u5373\u5199\u96c6\u9a8c\u8bc1\u548c\u5199\u96c6APPLY\uff0c\u5199\u96c6APPLY\u7684\u5e76\u53d1\u63a7\u5236\uff0c\u662f\u4e0e\u53c2\u6570wsrep_slave_threads\u6709\u5173\u7cfb\u7684\uff0c\u672c\u8eab\u5728\u9a8c\u8bc1\u4e4b\u540e\uff0c\u786e\u5b9a\u4e86\u76f8\u4e92\u7684\u4f9d\u8d56\u5173\u7cfb\u4e4b\u540e\uff0c\u5982\u679c\u786e\u5b9a\u6ca1\u6709\u5173\u7cfb\u7684\uff0c\u5c31\u53ef\u4ee5\u5e76\u884c\u4e86\uff0c\u800c\u5e76\u884c\u5ea6\uff0c\u5c31\u662f\u53c2\u6570wsrep_slave_threads\u7684\u4e8b\u60c5\u4e86\u3002wsrep_slave_threads\u53ef\u4ee5\u53c2\u7167\u53c2\u6570wsrep_cert_deps_distance\u6765\u8bbe\u7f6e\u3002<\/p>\n 3.2 \u6d41\u91cf\u63a7\u5236<\/strong><\/span><\/div>\n \u5728PXC\u4e2d\uff0c\u6709\u4e00\u4e2a\u53c2\u6570\u53ebfc_limit\uff0c\u5b83\u7684\u5168\u540d\u5176\u5b9e\u662f\u53ebflow control limit\uff0c\u987e\u540d\u601d\u4e49\uff0c\u662f\u6d41\u91cf\u63a7\u5236\u5927\u5c0f\u9650\u5236\u7684\u610f\u601d\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u4ec0\u4e48\u5462\uff1f<\/p>\n \u5982\u679c\u4e00\u5957\u96c6\u7fa4\u4e2d\uff0c\u67d0\u4e2a\u8282\u70b9\uff0c\u6216\u8005\u67d0\u51e0\u4e2a\u8282\u70b9\u7684\u786c\u4ef6\u8d44\u6e90\u6bd4\u8f83\u5dee\uff0c\u6216\u8005\u7531\u4e8e\u8282\u70b9\u538b\u529b\u5927\uff0c\u5bfc\u81f4\u590d\u5236\u6548\u7387\u4f4e\u4e0b\uff0c\u7b49\u7b49\u5404\u79cd\u539f\u56e0\uff0c\u5bfc\u81f4\u7684\u7ed3\u679c\u662f\uff0c\u4ece\u8282\u70b9APPLY\u65f6\uff0c\u975e\u5e38\u6162\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e3b\u5e93\u5728\u4e00\u79d2\u949f\u4e4b\u5185\u505a\u7684\u64cd\u4f5c\uff0c\u4ece\u5e93\u6709\u53ef\u80fd\u4f1a\u75282\u79d2\u624d\u80fd\u5b8c\u6210\uff0c\u90a3\u4e48\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c31\u4f1a\u5bfc\u81f4\u4ece\u8282\u70b9\u6267\u884c\u4efb\u52a1\u7684\u5806\u79ef\uff0c\u63a5\u6536\u961f\u5217\u7684\u5806\u79ef\u3002<\/p>\n \u5047\u8bbe\u4ece\u8282\u70b9\u771f\u7684\u5806\u79ef\u4e86\uff0c\u90a3\u4e48Galera\u4f1a\u8ba9\u5b83\u4e00\u76f4\u5806\u79ef\u4e0b\u53bb\u4e48\uff1f\u8fd9\u6837\u5ef6\u8fdf\u4f1a\u8d8a\u6765\u8d8a\u4e25\u91cd\uff0c\u8fd9\u6837Galera Cluster\u5c31\u53d8\u6210\u4e00\u4e2a\u4e3b\u4ece\u67b6\u6784\u7684\u96c6\u7fa4\u4e86\uff0c\u5df2\u7ecf\u5931\u53bb\u4e86\u5f3a\u4e00\u81f4\u72b6\u6001\u7684\u5c5e\u6027\u4e86\uff0c\u90a3\u4e48\u5f88\u660e\u663e\uff0cGalera\u662f\u4e0d\u4f1a\u8ba9\u8fd9\u79cd\u4e8b\u60c5\u53d1\u751f\u7684\uff0c\u90a3\u4e48\u6b64\u65f6\uff0c\u5c31\u8bf4\u56de\u5230\u5f00\u5934\u63d0\u5230\u7684\u53c2\u6570\u4e86\uff0cgcs.fc_limit\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u5728MySQL\u53c2\u6570wsrep_provider_options\u4e2d\u6765\u914d\u7f6e\u7684\uff0c\u8fd9\u4e2a\u53c2\u6570\u662fGalera\u7684\u4e00\u4e2a\u53c2\u6570\u96c6\u5408\uff0c\u6709\u5173\u4e8eFlow Control\u7684\uff0c\u8fd8\u5305\u62ecgcs.fc_factor\uff0c\u8fd9\u4e24\u4e2a\u53c2\u6570\u7684\u610f\u4e49\u662f\uff0c\u5f53\u4ece\u8282\u70b9\u5806\u79ef\u7684\u4e8b\u52a1\u6570\u91cf\u8d85\u8fc7gcs.fc_limit\u7684\u503c\u65f6\uff0c\u4ece\u8282\u70b9\u5c31\u53d1\u8d77\u4e00\u4e2aFlow Control\uff0c\u800c\u5f53\u4ece\u8282\u70b9\u5806\u79ef\u7684\u4e8b\u52a1\u6570\u5c0f\u4e8egcs.fc_limit * gcs.fc_factor\u65f6\uff0c\u53d1\u8d77Flow Control\u7684\u4ece\u8282\u70b9\u518d\u53d1\u8d77\u4e00\u4e2a\u89e3\u9664\u7684\u6d88\u606f\uff0c\u8ba9\u6574\u4e2a\u96c6\u7fa4\u518d\u6062\u590d\u3002<\/p>\n \u4f46\u6211\u4eec\u4e00\u822c\u6240\u5173\u5fc3\u7684\uff0c\u5c31\u662f\u5982\u4f55\u89e3\u51b3\uff0c\u4e0b\u9762\u6709\u51e0\u4e2a\u4e00\u822c\u6240\u91c7\u7528\u7684\u65b9\u6cd5\uff1a<\/p>\n \u53d1\u9001FC\u6d88\u606f\u7684\u8282\u70b9\uff0c\u786c\u4ef6\u6709\u53ef\u80fd\u51fa\u73b0\u95ee\u9898\u4e86\uff0c\u6bd4\u5982IO\u5199\u4e0d\u8fdb\u53bb\uff0c\u5f88\u6162\uff0cCPU\u5f02\u5e38\u9ad8\u7b49 3.3 \u6709\u5f88\u591a\u5751\uff1f<\/strong><\/span><\/div>\n \u6709\u5f88\u591a\u540c\u5b66\uff0c\u5728\u4f7f\u7528\u8fc7Galera Cluster\u4e4b\u540e\uff0c\u53d1\u73b0\u5f88\u591a\u95ee\u9898\uff0c\u6700\u5927\u7684\u6bd4\u5982DDL\u7684\u6267\u884c\uff0c\u5927\u4e8b\u52a1\u7b49\uff0c\u4ece\u800c\u5bfc\u81f4\u670d\u52a1\u7684\u4e0d\u53cb\u597d\uff0c\u8fd9\u4e5f\u662f\u5bfc\u81f4\u5f88\u591a\u4eba\u653e\u5f03\u7684\u539f\u56e0\u3002<\/p>\n DDL\u6267\u884c\u5361\u6b7b\u4f20\u8bf4\uff1a\u4f7f\u7528\u8fc7\u7684\u540c\u5b66\u53ef\u80fd\u77e5\u9053\uff0c\u5728Galera Cluster\u4e2d\u6267\u884c\u4e00\u4e2a\u5927\u7684\u6539\u8868\u64cd\u4f5c\uff0c\u4f1a\u5bfc\u81f4\u6574\u4e2a\u96c6\u7fa4\u5728\u4e00\u6bb5\u65f6\u95f4\u5185\uff0c\u662f\u5b8c\u5168\u5199\u5165\u4e0d\u4e86\u4efb\u4f55\u4e8b\u52a1\u7684\uff0c\u90fd\u5361\u6b7b\u5728\u90a3\u91cc\uff0c\u8fd9\u4e2a\u60c5\u51b5\u786e\u5b9e\u5f88\u4e25\u91cd\uff0c\u5bfc\u81f4\u7ebf\u4e0a\u5b8c\u5168\u4e0d\u53ef\u670d\u52a1\u4e86\uff0c\u539f\u56e0\u8fd8\u662f\u5e76\u53d1\u63a7\u5236\uff0c\u56e0\u4e3a\u63d0\u4ea4\u64cd\u4f5c\u8bbe\u7f6e\u4e3a\u4e32\u884c\u7684\uff0cDDL\u6267\u884c\u662f\u4e00\u4e2a\u63d0\u4ea4\u7684\u8fc7\u7a0b\uff0c\u90a3\u4e48\u4e32\u884c\u6267\u884c\u6539\u8868\uff0c\u5f53\u7136\u6267\u884c\u591a\u4e45\uff0c\u5c31\u5361\u591a\u4e45\uff0c\u76f4\u5230\u6539\u8868\u6267\u884c\u5b8c\uff0c\u5176\u5b83\u4e8b\u52a1\u4e5f\u5c31\u53ef\u4ee5\u7ee7\u7eed\u64cd\u4f5c\u4e86\uff0c\u8fd9\u4e2a\u95ee\u9898\u73b0\u5728\u6ca1\u529e\u6cd5\u89e3\u51b3\uff0c\u4f46\u6211\u4eec\u957f\u671f\u4f7f\u7528\u4e0b\u6765\u53d1\u73b0\uff0c\u5c0f\u8868\u53ef\u4ee5\u8fd9\u6837\u76f4\u63a5\u64cd\u4f5c\uff0c\u5927\u4e00\u70b9\u6216\u8005\u66f4\u5927\u7684\uff0c\u90fd\u662f\u901a\u8fc7osc\uff08pt-online-schema-change\uff09\u6765\u505a\uff0c\u8fd9\u6837\u5c31\u5f88\u597d\u7684\u907f\u514d\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002 4. \u9002\u7528\u573a\u666f<\/strong><\/div>\n \u73b0\u5728\u5bf9Galera Cluster\u5df2\u7ecf\u6709\u4e86\u8db3\u591f\u4e86\u89e3\uff0c\u4f46\u8fd9\u6837\u7684\u201c\u5b8c\u7f8e\u201d\u67b6\u6784\uff0c\u5728\u4ec0\u4e48\u573a\u666f\u4e0b\u624d\u53ef\u4ee5\u4f7f\u7528\u5462\uff1f\u6216\u8005\u8bf4\uff0c\u54ea\u79cd\u573a\u666f\u53c8\u4e0d\u9002\u5408\u4f7f\u7528\u8fd9\u6837\u7684\u67b6\u6784\u5462\uff1f\u9488\u5bf9\u5b83\u7684\u7f3a\u70b9\uff0c\u53ca\u4f18\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u626c\u5176\u957f\uff0c\u907f\u5176\u77ed\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u51e0\u4e2a\u65b9\u9762\uff0c\u6765\u4e86\u89e3\u5176\u9002\u7528\u573a\u666f\u3002<\/p>\n \u6570\u636e\u5f3a\u4e00\u81f4\u6027\uff1a\u56e0\u4e3aGalera Cluster\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u6570\u636e\u5f3a\u4e00\u81f4\u6027\u7684\uff0c\u6240\u4ee5\u5b83\u66f4\u9002\u5408\u5e94\u7528\u4e8e\u5bf9\u6570\u636e\u4e00\u81f4\u6027\u548c\u5b8c\u6574\u6027\u8981\u6c42\u7279\u522b\u9ad8\u7684\u573a\u666f\uff0c\u6bd4\u5982\u4ea4\u6613\uff0c\u6b63\u662f\u56e0\u4e3a\u8fd9\u4e2a\u7279\u6027\uff0c\u6211\u4eec\u53bb\u54ea\u513f\u7f51\u624d\u4f1a\u6210\u4e3a\u4f7f\u7528Galera Cluster\u7684\u7b2c\u4e00\u5927\u6237\u3002 5. \u603b\u7ed3<\/strong><\/div>\n \u7efc\u4e0a\u6240\u8ff0\uff0cGalera Cluster\u662f\u4e00\u4e2a\u5b8c\u5168\u53ef\u4f9d\u8d56\u7684\uff0cMySQL\u6570\u636e\u4e00\u81f4\u6027\u7684\u7edd\u6740\u5229\u5668\uff0c\u4f7f\u7528\u4e2d\u5b8c\u5168\u4e0d\u9700\u8981\u62c5\u5fc3\u6570\u636e\u5ef6\u8fdf\uff0c\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\uff0cDBA\u4ece\u6b64\u5c31\u4ece\u7e41\u590d\u7684\u6570\u636e\u4fee\u590d\u3001\u89e3\u51b3\u590d\u5236\u5ef6\u8fdf\u3001\u7ef4\u62a4\u65f6\u62c5\u5fc3\u5f71\u54cd\u4e1a\u52a1\u7684\u95ee\u9898\u4e2d\u5f7b\u5e95\u89e3\u8131\u4e86\u3002\u53ef\u4ee5\u8bf4Galera Cluster\u662fDBA\u53ca\u4e1a\u52a1\u7cfb\u7edf\u7684\u798f\u97f3\uff0c\u4e5f\u662fMySQL\u53d1\u5c55\u7684\u5927\u8d8b\u52bf\uff0c\u6211\u5e0c\u671b\u5b83\u4f1a\u8d8a\u6765\u8d8a\u597d\uff0c\u4e5f\u5e0c\u671b\u4e5f\u6709\u8d8a\u6765\u8d8a\u591a\u7684\u4eba\u4f7f\u7528\u5b83\uff0c\u5171\u540c\u7ef4\u62a4\u8fd9\u4e2a\u7f8e\u597d\u7684\u5927\u73af\u5883\u3002<\/p>\n \n |