{"id":76020,"date":"2024-10-16T03:11:16","date_gmt":"2024-10-15T19:11:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/76020\/"},"modified":"2024-10-16T03:11:16","modified_gmt":"2024-10-15T19:11:16","slug":"mysql-%e9%9b%86%e7%be%a4cge%e9%9b%bb%e4%bf%a1%e9%81%8b%e7%87%9f%e5%95%86%e7%b4%9a%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/76020\/","title":{"rendered":"MySQL \u96c6\u7fa4CGE\u96fb\u4fe1\u904b\u71df\u5546\u7d1a\u7248\u672c"},"content":{"rendered":"<h1 id=\"mysql-%e9%9b%86%e7%be%a4cge%e9%9b%bb%e4%bf%a1%e9%81%8b%e7%87%9f%e5%95%86%e7%b4%9a%e7%89%88%e6%9c%ac-DngXrKEABV\">MySQL \u96c6\u7fa4CGE\u96fb\u4fe1\u904b\u71df\u5546\u7d1a\u7248\u672c<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u53ef\u7528\u6027\u5c0d\u65bc\u4f01\u696d\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002MySQL \u4f5c\u70ba\u4e00\u500b\u958b\u6e90\u7684\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5df2\u7d93\u88ab\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u884c\u696d\u3002\u96a8\u8457\u9700\u6c42\u7684\u589e\u52a0\uff0cMySQL \u96c6\u7fa4\uff08MySQL Cluster\uff09\u4f5c\u70ba\u4e00\u7a2e\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u64f4\u5c55\u6027\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u8d8a\u4f86\u8d8a\u53d7\u5230\u91cd\u8996\u3002\u7279\u5225\u662f\u96fb\u4fe1\u904b\u71df\u5546\u7d1a\u7248\u672c\uff08CGE\uff09\uff0c\u5b83\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\uff0c\u9069\u5408\u5927\u898f\u6a21\u7684\u6578\u64da\u8655\u7406\u9700\u6c42\u3002<\/p>\n<h2 id=\"mysql-%e9%9b%86%e7%be%a4%e7%9a%84%e6%9e%b6%e6%a7%8b-DngXrKEABV\">MySQL \u96c6\u7fa4\u7684\u67b6\u69cb<\/h2>\n<p>MySQL \u96c6\u7fa4\u7684\u67b6\u69cb\u4e3b\u8981\u7531\u4ee5\u4e0b\u5e7e\u500b\u7d44\u4ef6\u7d44\u6210\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u7bc0\u9ede\uff08Data Nodes\uff09<\/strong>\uff1a\u8ca0\u8cac\u5b58\u5132\u6578\u64da\uff0c\u652f\u6301\u9ad8\u53ef\u7528\u6027\u548c\u6578\u64da\u5197\u9918\u3002<\/li>\n<li><strong>\u7ba1\u7406\u7bc0\u9ede\uff08Management Nodes\uff09<\/strong>\uff1a\u8ca0\u8cac\u96c6\u7fa4\u7684\u7ba1\u7406\u548c\u914d\u7f6e\uff0c\u78ba\u4fdd\u96c6\u7fa4\u7684\u6b63\u5e38\u904b\u884c\u3002<\/li>\n<li><strong>SQL \u7bc0\u9ede\uff08SQL Nodes\uff09<\/strong>\uff1a\u7528\u65bc\u8655\u7406\u5ba2\u6236\u7aef\u7684\u67e5\u8a62\u8acb\u6c42\uff0c\u4e26\u8207\u6578\u64da\u7bc0\u9ede\u9032\u884c\u4ea4\u4e92\u3002<\/li>\n<\/ul>\n<p>\u9019\u7a2e\u5206\u5e03\u5f0f\u67b6\u69cb\u4f7f\u5f97 MySQL \u96c6\u7fa4\u80fd\u5920\u5728\u591a\u500b\u7bc0\u9ede\u4e4b\u9593\u5206\u6563\u8ca0\u8f09\uff0c\u5f9e\u800c\u63d0\u9ad8\u6574\u9ad4\u6027\u80fd\u548c\u53ef\u7528\u6027\u3002<\/p>\n<h2 id=\"cge%e7%89%88%e6%9c%ac%e7%9a%84%e7%89%b9%e9%bb%9e-DngXrKEABV\">CGE\u7248\u672c\u7684\u7279\u9ede<\/h2>\n<p>MySQL \u96c6\u7fa4CGE\u7248\u672c\u5c08\u70ba\u96fb\u4fe1\u904b\u71df\u5546\u8a2d\u8a08\uff0c\u5177\u6709\u4ee5\u4e0b\u5e7e\u500b\u986f\u8457\u7279\u9ede\uff1a<\/p>\n<ul>\n<li><strong>\u9ad8\u53ef\u7528\u6027<\/strong>\uff1aCGE\u7248\u672c\u652f\u6301\u81ea\u52d5\u6545\u969c\u8f49\u79fb\uff0c\u78ba\u4fdd\u7cfb\u7d71\u5728\u51fa\u73fe\u6545\u969c\u6642\u80fd\u5920\u8fc5\u901f\u6062\u5fa9\u3002<\/li>\n<li><strong>\u53ef\u64f4\u5c55\u6027<\/strong>\uff1a\u7528\u6236\u53ef\u4ee5\u6839\u64da\u9700\u6c42\u96a8\u6642\u6dfb\u52a0\u6216\u522a\u9664\u7bc0\u9ede\uff0c\u9748\u6d3b\u61c9\u5c0d\u696d\u52d9\u589e\u9577\u3002<\/li>\n<li><strong>\u5be6\u6642\u6578\u64da\u8655\u7406<\/strong>\uff1a\u652f\u6301\u9ad8\u541e\u5410\u91cf\u7684\u6578\u64da\u8655\u7406\uff0c\u9069\u5408\u9700\u8981\u5373\u6642\u97ff\u61c9\u7684\u61c9\u7528\u5834\u666f\u3002<\/li>\n<li><strong>\u591a\u7248\u672c\u4e26\u884c<\/strong>\uff1a\u652f\u6301\u591a\u500b\u7248\u672c\u7684\u6578\u64da\u5eab\u540c\u6642\u904b\u884c\uff0c\u65b9\u4fbf\u7528\u6236\u9032\u884c\u7248\u672c\u5347\u7d1a\u548c\u6e2c\u8a66\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e6%a1%88%e4%be%8b-DngXrKEABV\">\u4f7f\u7528\u6848\u4f8b<\/h2>\n<p>\u8a31\u591a\u5927\u578b\u96fb\u4fe1\u904b\u71df\u5546\u548c\u4e92\u806f\u7db2\u516c\u53f8\u5df2\u7d93\u6210\u529f\u90e8\u7f72\u4e86 MySQL \u96c6\u7fa4CGE\u7248\u672c\u3002\u4f8b\u5982\uff0c\u4e00\u5bb6\u5927\u578b\u96fb\u4fe1\u516c\u53f8\u5229\u7528 MySQL \u96c6\u7fa4\u4f86\u8655\u7406\u5176\u7528\u6236\u7684\u901a\u8a71\u8a18\u9304\u548c\u8a08\u8cbb\u6578\u64da\uff0c\u901a\u904e\u9ad8\u53ef\u7528\u6027\u548c\u5be6\u6642\u6578\u64da\u8655\u7406\uff0c\u986f\u8457\u63d0\u9ad8\u4e86\u5ba2\u6236\u6eff\u610f\u5ea6\u548c\u696d\u52d9\u6548\u7387\u3002<\/p>\n<h3 id=\"%e5%ae%89%e8%a3%9d%e8%88%87%e9%85%8d%e7%bd%ae-DngXrKEABV\">\u5b89\u88dd\u8207\u914d\u7f6e<\/h3>\n<p>\u5b89\u88dd MySQL \u96c6\u7fa4CGE\u7248\u672c\u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\uff0c\u4ee5\u4e0b\u662f\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<pre><code>\n# 1. \u4e0b\u8f09 MySQL \u96c6\u7fa4CGE\u7248\u672c\nwget https:\/\/dev.mysql.com\/get\/Downloads\/MySQL-Cluster\/mysql-cluster-gpl-7.6.5-linux-glibc2.12-x86_64.tar.gz\n\n# 2. \u89e3\u58d3\u7e2e\ntar -xzf mysql-cluster-gpl-7.6.5-linux-glibc2.12-x86_64.tar.gz\n\n# 3. \u914d\u7f6e\u7ba1\u7406\u7bc0\u9ede\ncd mysql-cluster-gpl-7.6.5\nmkdir -p \/var\/lib\/mysql-cluster\ncat &gt; \/var\/lib\/mysql-cluster\/config.ini &lt;&lt;EOF\n[NDBD DEFAULT]\nNoOfReplicas=2\n\n[NDBD]\nId=1\nHostName=192.168.1.1\n\n[NDBD]\nId=2\nHostName=192.168.1.2\n\n[MYSQLD]\nId=3\nHostName=192.168.1.3\nEOF\n\n# 4. \u555f\u52d5\u96c6\u7fa4\nndb_mg -f \/var\/lib\/mysql-cluster\/config.ini\n<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-DngXrKEABV\">\u7e3d\u7d50<\/h2>\n<p>MySQL \u96c6\u7fa4CGE\u96fb\u4fe1\u904b\u71df\u5546\u7d1a\u7248\u672c\u662f\u4e00\u500b\u5f37\u5927\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u6eff\u8db3\u73fe\u4ee3\u4f01\u696d\u5c0d\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u64f4\u5c55\u6027\u7684\u9700\u6c42\u3002\u96a8\u8457\u6578\u64da\u91cf\u7684\u6301\u7e8c\u589e\u9577\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u67b6\u69cb\u5c07\u6210\u70ba\u4f01\u696d\u6210\u529f\u7684\u95dc\u9375\u3002\u5c0d\u65bc\u9700\u8981\u7a69\u5b9a\u548c\u9ad8\u6548\u6578\u64da\u8655\u7406\u7684\u7528\u6236\uff0cMySQL \u96c6\u7fa4CGE\u7248\u672c\u7121\u7591\u662f\u4e00\u500b\u503c\u5f97\u8003\u616e\u7684\u9078\u64c7\u3002\u5982\u679c\u60a8\u5c0d\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u6216\u5176\u4ed6 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u89e3\u6c7a\u65b9\u6848\u611f\u8208\u8da3\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22MySQL\u96c6\u7fa4CGE\u96fb\u4fe1\u904b\u71df\u5546\u7d1a\u7248\u672c\uff0c\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u3001\u64f4\u5c55\u6027\u548c\u6027\u80fd\uff0c\u6eff\u8db3\u96fb\u4fe1\u884c\u696d\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-76020","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=76020"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76020\/revisions"}],"predecessor-version":[{"id":76021,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76020\/revisions\/76021"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=76020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=76020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=76020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}