{"id":76022,"date":"2024-10-16T03:12:15","date_gmt":"2024-10-15T19:12:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/76022\/"},"modified":"2024-10-16T03:12:15","modified_gmt":"2024-10-15T19:12:15","slug":"mysql-%e9%9b%86%e7%be%a4%e7%b0%a1%e4%bb%8b%e8%88%87%e9%85%8d%e7%bd%ae%e8%a9%b3%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/76022\/","title":{"rendered":"MySQL \u96c6\u7fa4\u7c21\u4ecb\u8207\u914d\u7f6e\u8a73\u89e3"},"content":{"rendered":"<h1 id=\"mysql-%e9%9b%86%e7%be%a4%e7%b0%a1%e4%bb%8b%e8%88%87%e9%85%8d%e7%bd%ae%e8%a9%b3%e8%a7%a3-UQuyyLzjcx\">MySQL \u96c6\u7fa4\u7c21\u4ecb\u8207\u914d\u7f6e\u8a73\u89e3<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u7684\u53ef\u7528\u6027\u548c\u64f4\u5c55\u6027\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002MySQL \u4f5c\u70ba\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u63d0\u4f9b\u4e86\u591a\u7a2e\u96c6\u7fa4\u89e3\u6c7a\u65b9\u6848\uff0c\u4ee5\u6eff\u8db3\u4e0d\u540c\u7684\u696d\u52d9\u9700\u6c42\u3002\u672c\u6587\u5c07\u4ecb\u7d39 MySQL \u96c6\u7fa4\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u914d\u7f6e\u904e\u7a0b\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-mysql-%e9%9b%86%e7%be%a4%ef%bc%9f-UQuyyLzjcx\">\u4ec0\u9ebc\u662f MySQL \u96c6\u7fa4\uff1f<\/h2>\n<p>MySQL \u96c6\u7fa4\u662f\u4e00\u7a2e\u9ad8\u53ef\u7528\u6027\u548c\u9ad8\u64f4\u5c55\u6027\u7684\u6578\u64da\u5eab\u67b6\u69cb\uff0c\u65e8\u5728\u652f\u6301\u5927\u898f\u6a21\u7684\u61c9\u7528\u7a0b\u5e8f\u3002\u5b83\u901a\u904e\u5c07\u6578\u64da\u5206\u6563\u5230\u591a\u500b\u7bc0\u9ede\u4e0a\u4f86\u5be6\u73fe\u8ca0\u8f09\u5747\u8861\u548c\u6545\u969c\u8f49\u79fb\u3002MySQL \u96c6\u7fa4\u7684\u6838\u5fc3\u7d44\u4ef6\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u7bc0\u9ede\uff1a<\/strong>\u8ca0\u8cac\u5b58\u5132\u6578\u64da\uff0c\u4e26\u8655\u7406\u67e5\u8a62\u8acb\u6c42\u3002<\/li>\n<li><strong>\u7ba1\u7406\u7bc0\u9ede\uff1a<\/strong>\u8ca0\u8cac\u96c6\u7fa4\u7684\u7ba1\u7406\u548c\u914d\u7f6e\u3002<\/li>\n<li><strong>SQL \u7bc0\u9ede\uff1a<\/strong>\u63d0\u4f9b SQL \u63a5\u53e3\uff0c\u5141\u8a31\u7528\u6236\u901a\u904e\u6a19\u6e96\u7684 SQL \u8a9e\u8a00\u8a2a\u554f\u6578\u64da\u3002<\/li>\n<\/ul>\n<h2 id=\"mysql-%e9%9b%86%e7%be%a4%e7%9a%84%e5%84%aa%e5%8b%a2-UQuyyLzjcx\">MySQL \u96c6\u7fa4\u7684\u512a\u52e2<\/h2>\n<p>\u4f7f\u7528 MySQL \u96c6\u7fa4\u7684\u4e3b\u8981\u512a\u52e2\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u9ad8\u53ef\u7528\u6027\uff1a<\/strong>\u96c6\u7fa4\u4e2d\u7684\u6578\u64da\u7bc0\u9ede\u53ef\u4ee5\u81ea\u52d5\u6aa2\u6e2c\u6545\u969c\u4e26\u9032\u884c\u6545\u969c\u8f49\u79fb\uff0c\u78ba\u4fdd\u7cfb\u7d71\u7684\u6301\u7e8c\u904b\u884c\u3002<\/li>\n<li><strong>\u53ef\u64f4\u5c55\u6027\uff1a<\/strong>\u53ef\u4ee5\u6839\u64da\u9700\u6c42\u8f15\u9b06\u6dfb\u52a0\u6216\u522a\u9664\u7bc0\u9ede\uff0c\u4ee5\u61c9\u5c0d\u6d41\u91cf\u7684\u8b8a\u5316\u3002<\/li>\n<li><strong>\u8ca0\u8f09\u5747\u8861\uff1a<\/strong>\u67e5\u8a62\u8acb\u6c42\u53ef\u4ee5\u5728\u591a\u500b\u7bc0\u9ede\u4e4b\u9593\u5206\u914d\uff0c\u5f9e\u800c\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"mysql-%e9%9b%86%e7%be%a4%e7%9a%84%e9%85%8d%e7%bd%ae%e6%ad%a5%e9%a9%9f-UQuyyLzjcx\">MySQL \u96c6\u7fa4\u7684\u914d\u7f6e\u6b65\u9a5f<\/h2>\n<p>\u4ee5\u4e0b\u662f\u914d\u7f6e MySQL \u96c6\u7fa4\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-UQuyyLzjcx\">1. \u74b0\u5883\u6e96\u5099<\/h3>\n<p>\u9996\u5148\uff0c\u78ba\u4fdd\u6240\u6709\u7bc0\u9ede\u4e0a\u5b89\u88dd\u4e86\u76f8\u540c\u7248\u672c\u7684 MySQL\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7248\u672c\uff1a<\/p>\n<pre><code>mysql --version<\/code><\/pre>\n<h3 id=\"2-%e5%ae%89%e8%a3%9d-mysql-%e9%9b%86%e7%be%a4-UQuyyLzjcx\">2. \u5b89\u88dd MySQL \u96c6\u7fa4<\/h3>\n<p>\u5728\u6bcf\u500b\u7bc0\u9ede\u4e0a\u5b89\u88dd MySQL \u96c6\u7fa4\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo apt-get install mysql-cluster-community-server<\/code><\/pre>\n<h3 id=\"3-%e9%85%8d%e7%bd%ae%e7%ae%a1%e7%90%86%e7%af%80%e9%bb%9e-UQuyyLzjcx\">3. \u914d\u7f6e\u7ba1\u7406\u7bc0\u9ede<\/h3>\n<p>\u5728\u7ba1\u7406\u7bc0\u9ede\u4e0a\uff0c\u5275\u5efa\u4e00\u500b\u914d\u7f6e\u6587\u4ef6\uff08\u5982 <code>config.ini<\/code>\uff09\uff0c\u4e26\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>[ndbd default]\nNoOfReplicas=2\n\n[ndbd]\nHostName=192.168.1.1\nDataPort=1186\n\n[ndbd]\nHostName=192.168.1.2\nDataPort=1186\n\n[mysqld]\nHostName=192.168.1.3\n<\/code><\/pre>\n<h3 id=\"4-%e5%95%9f%e5%8b%95%e9%9b%86%e7%be%a4-UQuyyLzjcx\">4. \u555f\u52d5\u96c6\u7fa4<\/h3>\n<p>\u5728\u7ba1\u7406\u7bc0\u9ede\u4e0a\u555f\u52d5\u96c6\u7fa4\uff1a<\/p>\n<pre><code>ndb_mgmd -f \/path\/to\/config.ini<\/code><\/pre>\n<p>\u7136\u5f8c\u5728\u6578\u64da\u7bc0\u9ede\u4e0a\u555f\u52d5 NDB \u5b58\u5132\u5f15\u64ce\uff1a<\/p>\n<pre><code>ndbd<\/code><\/pre>\n<h3 id=\"5-%e9%85%8d%e7%bd%ae-sql-%e7%af%80%e9%bb%9e-UQuyyLzjcx\">5. \u914d\u7f6e SQL \u7bc0\u9ede<\/h3>\n<p>\u5728 SQL \u7bc0\u9ede\u4e0a\uff0c\u7de8\u8f2f MySQL \u914d\u7f6e\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre><code>ndbcluster<\/code><\/pre>\n<p>\u7136\u5f8c\u555f\u52d5 MySQL \u670d\u52d9\uff1a<\/p>\n<pre><code>service mysql start<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-UQuyyLzjcx\">\u7e3d\u7d50<\/h2>\n<p>MySQL \u96c6\u7fa4\u662f\u4e00\u7a2e\u5f37\u5927\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u64f4\u5c55\u6027\uff0c\u9069\u5408\u5404\u7a2e\u898f\u6a21\u7684\u61c9\u7528\u7a0b\u5e8f\u3002\u901a\u904e\u6b63\u78ba\u7684\u914d\u7f6e\uff0c\u4f01\u696d\u53ef\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u5176\u6578\u64da\u5eab\u9700\u6c42\uff0c\u78ba\u4fdd\u7cfb\u7d71\u7684\u7a69\u5b9a\u904b\u884c\u3002\u5982\u679c\u60a8\u5c0d\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u6216\u5176\u4ed6\u76f8\u95dc\u670d\u52d9\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>\u4e86\u89e3MySQL\u96c6\u7fa4\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u914d\u7f6e\u6b65\u9a5f\uff0c\u52a9\u60a8\u9ad8\u6548\u7ba1\u7406\u6578\u64da\u5eab\uff0c\u63d0\u5347\u7cfb\u7d71\u7a69\u5b9a\u6027\u8207\u6027\u80fd\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-76022","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76022","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=76022"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76022\/revisions"}],"predecessor-version":[{"id":76023,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76022\/revisions\/76023"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=76022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=76022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=76022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}