{"id":75878,"date":"2024-10-16T01:59:16","date_gmt":"2024-10-15T17:59:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/75878\/"},"modified":"2024-10-16T01:59:16","modified_gmt":"2024-10-15T17:59:16","slug":"mysql-%e5%ad%98%e5%84%b2%e5%af%ab%e5%85%a5%e9%80%9f%e5%ba%a6%e6%85%a2%ef%bc%9f%e7%95%b6%e7%84%b6%e6%98%af%e9%81%b8%e6%93%87%e5%88%86%e6%9e%90%e4%b8%80%e4%b8%8b%e5%95%a6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/75878\/","title":{"rendered":"MySQL \u5b58\u5132\u5beb\u5165\u901f\u5ea6\u6162\uff1f\u7576\u7136\u662f\u9078\u64c7\u5206\u6790\u4e00\u4e0b\u5566"},"content":{"rendered":"<h1 id=\"mysql-%e5%ad%98%e5%84%b2%e5%af%ab%e5%85%a5%e9%80%9f%e5%ba%a6%e6%85%a2%ef%bc%9f%e7%95%b6%e7%84%b6%e6%98%af%e9%81%b8%e6%93%87%e5%88%86%e6%9e%90%e4%b8%80%e4%b8%8b%e5%95%a6-ARodNnYDPx\">MySQL \u5b58\u5132\u5beb\u5165\u901f\u5ea6\u6162\uff1f\u7576\u7136\u662f\u9078\u64c7\u5206\u6790\u4e00\u4e0b\u5566<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u6027\u80fd\u5c0d\u65bc\u61c9\u7528\u7a0b\u5e8f\u7684\u6574\u9ad4\u8868\u73fe\u81f3\u95dc\u91cd\u8981\u3002MySQL \u4f5c\u70ba\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u7136\u800c\uff0c\u8a31\u591a\u7528\u6236\u5728\u4f7f\u7528 MySQL \u6642\uff0c\u53ef\u80fd\u6703\u9047\u5230\u5b58\u5132\u5beb\u5165\u901f\u5ea6\u6162\u7684\u554f\u984c\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u53ef\u80fd\u5c0e\u81f4\u9019\u4e00\u554f\u984c\u7684\u539f\u56e0\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"1-%e7%a1%ac%e9%ab%94%e9%99%90%e5%88%b6-ARodNnYDPx\">1. \u786c\u9ad4\u9650\u5236<\/h2>\n<p>\u5b58\u5132\u5beb\u5165\u901f\u5ea6\u7684\u9996\u8981\u56e0\u7d20\u4e4b\u4e00\u662f\u786c\u9ad4\u6027\u80fd\u3002\u5982\u679c\u4f3a\u670d\u5668\u7684\u786c\u789f\u901f\u5ea6\u8f03\u6162\uff0c\u9019\u5c07\u76f4\u63a5\u5f71\u97ff\u5230 MySQL \u7684\u5beb\u5165\u6027\u80fd\u3002\u50b3\u7d71\u7684\u6a5f\u68b0\u786c\u789f\uff08HDD\uff09\u76f8\u6bd4\u56fa\u614b\u786c\u789f\uff08SSD\uff09\u5728\u8b80\u5beb\u901f\u5ea6\u4e0a\u6709\u8457\u660e\u986f\u7684\u52a3\u52e2\u3002<\/p>\n<ul>\n<li><strong>\u89e3\u6c7a\u65b9\u6848\uff1a<\/strong>\u8003\u616e\u5347\u7d1a\u5230 SSD\uff0c\u9019\u5c07\u986f\u8457\u63d0\u9ad8\u6578\u64da\u7684\u8b80\u5beb\u901f\u5ea6\u3002<\/li>\n<\/ul>\n<h2 id=\"2-mysql-%e9%85%8d%e7%bd%ae-ARodNnYDPx\">2. MySQL \u914d\u7f6e<\/h2>\n<p>MySQL \u7684\u914d\u7f6e\u5c0d\u65bc\u6027\u80fd\u6709\u8457\u91cd\u8981\u5f71\u97ff\u3002\u9ed8\u8a8d\u914d\u7f6e\u53ef\u80fd\u4e0d\u9069\u5408\u6240\u6709\u7684\u61c9\u7528\u5834\u666f\uff0c\u7279\u5225\u662f\u5728\u9ad8\u8ca0\u8f09\u7684\u60c5\u6cc1\u4e0b\u3002<\/p>\n<ul>\n<li><strong>InnoDB Buffer Pool Size\uff1a<\/strong>\u9019\u500b\u53c3\u6578\u6c7a\u5b9a\u4e86 InnoDB \u5b58\u5132\u5f15\u64ce\u7528\u65bc\u7de9\u5b58\u6578\u64da\u548c\u7d22\u5f15\u7684\u5167\u5b58\u5927\u5c0f\u3002\u9069\u7576\u589e\u52a0\u9019\u500b\u503c\u53ef\u4ee5\u63d0\u9ad8\u5beb\u5165\u6027\u80fd\u3002<\/li>\n<li><strong>Log File Size\uff1a<\/strong>\u589e\u5927 redo log \u6587\u4ef6\u7684\u5927\u5c0f\u53ef\u4ee5\u6e1b\u5c11\u78c1\u789f I\/O \u64cd\u4f5c\uff0c\u5f9e\u800c\u63d0\u9ad8\u5beb\u5165\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h3 id=\"%e7%a4%ba%e4%be%8b%e9%85%8d%e7%bd%ae-ARodNnYDPx\">\u793a\u4f8b\u914d\u7f6e<\/h3>\n<pre><code>\n[mysqld]\ninnodb_buffer_pool_size = 1G\ninnodb_log_file_size = 256M\n<\/code><\/pre>\n<h2 id=\"3-%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a8%ad%e8%a8%88-ARodNnYDPx\">3. \u6578\u64da\u5eab\u8a2d\u8a08<\/h2>\n<p>\u6578\u64da\u5eab\u7684\u8a2d\u8a08\u4e5f\u6703\u5f71\u97ff\u5beb\u5165\u901f\u5ea6\u3002\u904e\u591a\u7684\u7d22\u5f15\u6703\u5c0e\u81f4\u5beb\u5165\u64cd\u4f5c\u8b8a\u6162\uff0c\u56e0\u70ba\u6bcf\u6b21\u5beb\u5165\u90fd\u9700\u8981\u66f4\u65b0\u7d22\u5f15\u3002<\/p>\n<ul>\n<li><strong>\u89e3\u6c7a\u65b9\u6848\uff1a<\/strong>\u6aa2\u67e5\u6578\u64da\u8868\u7684\u7d22\u5f15\uff0c\u522a\u9664\u4e0d\u5fc5\u8981\u7684\u7d22\u5f15\uff0c\u4e26\u8003\u616e\u4f7f\u7528\u5408\u9069\u7684\u6578\u64da\u985e\u578b\u4f86\u6e1b\u5c11\u5b58\u5132\u7a7a\u9593\u3002<\/li>\n<\/ul>\n<h2 id=\"4-%e5%af%ab%e5%85%a5%e6%93%8d%e4%bd%9c%e7%9a%84%e6%89%b9%e9%87%8f%e8%99%95%e7%90%86-ARodNnYDPx\">4. \u5beb\u5165\u64cd\u4f5c\u7684\u6279\u91cf\u8655\u7406<\/h2>\n<p>\u55ae\u6b21\u5beb\u5165\u64cd\u4f5c\u7684\u6027\u80fd\u901a\u5e38\u4e0d\u5982\u6279\u91cf\u5beb\u5165\u3002\u5c07\u591a\u500b\u5beb\u5165\u64cd\u4f5c\u5408\u4f75\u6210\u4e00\u500b\u6279\u91cf\u64cd\u4f5c\uff0c\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a2%bc-ARodNnYDPx\">\u793a\u4f8b\u4ee3\u78bc<\/h3>\n<pre><code>\nINSERT INTO table_name (column1, column2) VALUES\n(value1a, value2a),\n(value1b, value2b),\n(value1c, value2c);\n<\/code><\/pre>\n<h2 id=\"5-%e7%9b%a3%e6%8e%a7%e5%92%8c%e8%aa%bf%e8%a9%a6-ARodNnYDPx\">5. \u76e3\u63a7\u548c\u8abf\u8a66<\/h2>\n<p>\u4f7f\u7528 MySQL \u7684\u6027\u80fd\u76e3\u63a7\u5de5\u5177\uff0c\u5982 MySQL Enterprise Monitor \u6216\u8005\u958b\u6e90\u7684 Percona Monitoring and Management\uff0c\u53ef\u4ee5\u5e6b\u52a9\u8b58\u5225\u6027\u80fd\u74f6\u9838\u3002<\/p>\n<ul>\n<li><strong>\u89e3\u6c7a\u65b9\u6848\uff1a<\/strong>\u5b9a\u671f\u6aa2\u67e5\u6162\u67e5\u8a62\u65e5\u8a8c\uff0c\u512a\u5316\u6162\u67e5\u8a62\uff0c\u4e26\u4f7f\u7528 EXPLAIN \u8a9e\u53e5\u5206\u6790\u67e5\u8a62\u8a08\u5283\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ARodNnYDPx\">\u7e3d\u7d50<\/h2>\n<p>MySQL \u5b58\u5132\u5beb\u5165\u901f\u5ea6\u6162\u7684\u554f\u984c\u53ef\u80fd\u7531\u591a\u7a2e\u56e0\u7d20\u5f15\u8d77\uff0c\u5305\u62ec\u786c\u9ad4\u9650\u5236\u3001\u914d\u7f6e\u4e0d\u7576\u3001\u6578\u64da\u5eab\u8a2d\u8a08\u4e0d\u5408\u7406\u4ee5\u53ca\u5beb\u5165\u64cd\u4f5c\u7684\u65b9\u5f0f\u7b49\u3002\u901a\u904e\u9069\u7576\u7684\u786c\u9ad4\u5347\u7d1a\u3001\u512a\u5316 MySQL \u914d\u7f6e\u3001\u6539\u5584\u6578\u64da\u5eab\u8a2d\u8a08\u4ee5\u53ca\u4f7f\u7528\u6279\u91cf\u5beb\u5165\u7b49\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u63d0\u9ad8\u5beb\u5165\u6027\u80fd\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u652f\u6301\u6216\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u4ee5\u7372\u5f97\u66f4\u9ad8\u6548\u7684\u6578\u64da\u5eab\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3 MySQL \u5b58\u5132\u5beb\u5165\u901f\u5ea6\u6162\u7684\u539f\u56e0\uff0c\u4e26\u63a2\u7d22\u6709\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u63d0\u5347\u6578\u64da\u5eab\u6027\u80fd\uff0c\u512a\u5316\u61c9\u7528\u6548\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-75878","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/75878","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=75878"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/75878\/revisions"}],"predecessor-version":[{"id":75879,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/75878\/revisions\/75879"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=75878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=75878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=75878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}