{"id":186522,"date":"2024-11-11T06:37:22","date_gmt":"2024-11-10T22:37:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/186522\/"},"modified":"2024-11-11T06:37:23","modified_gmt":"2024-11-10T22:37:23","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e4%bc%ba%e6%9c%8d%e5%99%a8%e4%b8%8d%e5%95%9f%e5%8b%95%ef%bc%8c%e5%8f%af%e8%83%bd%e7%9a%84%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%b3%95%e7%b0%a1%e6%9e%90%ef%bc%88%e6%95%b8%e6%93%9a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/186522\/","title":{"rendered":"\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u555f\u52d5\uff0c\u53ef\u80fd\u7684\u89e3\u6c7a\u65b9\u6cd5\u7c21\u6790\uff08\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u904b\u884c\uff09"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e4%bc%ba%e6%9c%8d%e5%99%a8%e4%b8%8d%e5%95%9f%e5%8b%95%ef%bc%8c%e5%8f%af%e8%83%bd%e7%9a%84%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%b3%95%e7%b0%a1%e6%9e%90%ef%bc%88%e6%95%b8%e6%93%9a-HyOUfdbwZN\">\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u555f\u52d5\uff0c\u53ef\u80fd\u7684\u89e3\u6c7a\u65b9\u6cd5\u7c21\u6790\uff08\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u904b\u884c\uff09<\/h1>\n<p>\u5728\u73fe\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u4f3a\u670d\u5668\u7684\u7a69\u5b9a\u6027\u548c\u53ef\u7528\u6027\u5c0d\u65bc\u4f01\u696d\u904b\u71df\u81f3\u95dc\u91cd\u8981\u3002\u7136\u800c\uff0c\u6578\u64da\u5eab\u4f3a\u670d\u5668\u6709\u6642\u53ef\u80fd\u6703\u51fa\u73fe\u7121\u6cd5\u555f\u52d5\u7684\u60c5\u6cc1\uff0c\u9019\u53ef\u80fd\u6703\u5c0e\u81f4\u696d\u52d9\u4e2d\u65b7\u548c\u6578\u64da\u640d\u5931\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u555f\u52d5\u7684\u5e38\u898b\u539f\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6cd5\u3002<\/p>\n<h2 id=\"%e5%b8%b8%e8%a6%8b%e5%8e%9f%e5%9b%a0-HyOUfdbwZN\">\u5e38\u898b\u539f\u56e0<\/h2>\n<ul>\n<li><strong>\u914d\u7f6e\u932f\u8aa4\uff1a<\/strong>\u6578\u64da\u5eab\u4f3a\u670d\u5668\u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u80fd\u5b58\u5728\u932f\u8aa4\uff0c\u5c0e\u81f4\u4f3a\u670d\u5668\u7121\u6cd5\u555f\u52d5\u3002<\/li>\n<li><strong>\u8cc7\u6e90\u4e0d\u8db3\uff1a<\/strong>\u4f3a\u670d\u5668\u7684\u5167\u5b58\u6216\u5b58\u5132\u7a7a\u9593\u4e0d\u8db3\uff0c\u7121\u6cd5\u6eff\u8db3\u6578\u64da\u5eab\u7684\u904b\u884c\u9700\u6c42\u3002<\/li>\n<li><strong>\u6578\u64da\u640d\u58de\uff1a<\/strong>\u6578\u64da\u5eab\u6587\u4ef6\u53ef\u80fd\u56e0\u610f\u5916\u95dc\u9589\u6216\u786c\u4ef6\u6545\u969c\u800c\u640d\u58de\u3002<\/li>\n<li><strong>\u7aef\u53e3\u885d\u7a81\uff1a<\/strong>\u6578\u64da\u5eab\u4f3a\u670d\u5668\u6240\u9700\u7684\u7aef\u53e3\u53ef\u80fd\u88ab\u5176\u4ed6\u61c9\u7528\u7a0b\u5e8f\u4f54\u7528\u3002<\/li>\n<li><strong>\u670d\u52d9\u672a\u555f\u52d5\uff1a<\/strong>\u6578\u64da\u5eab\u670d\u52d9\u672c\u8eab\u53ef\u80fd\u672a\u6b63\u78ba\u555f\u52d5\u6216\u5df2\u505c\u6b62\u3002<\/li>\n<\/ul>\n<h2 id=\"%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%b3%95-HyOUfdbwZN\">\u89e3\u6c7a\u65b9\u6cd5<\/h2>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6-HyOUfdbwZN\">1. \u6aa2\u67e5\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u9996\u5148\uff0c\u6aa2\u67e5\u6578\u64da\u5eab\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u5982 MySQL \u7684 my.cnf \u6216 PostgreSQL \u7684 postgresql.conf\uff09\u3002\u78ba\u4fdd\u6240\u6709\u8a2d\u7f6e\u6b63\u78ba\u7121\u8aa4\uff0c\u7279\u5225\u662f\u8207\u6578\u64da\u76ee\u9304\u3001\u7aef\u53e3\u548c\u7528\u6236\u6b0a\u9650\u76f8\u95dc\u7684\u8a2d\u7f6e\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u914d\u7f6e\u6587\u4ef6\u7684\u8a9e\u6cd5\uff1a<\/p>\n<pre><code>mysqld --verbose --help<\/code><\/pre>\n<h3 id=\"2-%e6%aa%a2%e6%9f%a5%e7%b3%bb%e7%b5%b1%e8%b3%87%e6%ba%90-HyOUfdbwZN\">2. \u6aa2\u67e5\u7cfb\u7d71\u8cc7\u6e90<\/h3>\n<p>\u4f7f\u7528\u7cfb\u7d71\u76e3\u63a7\u5de5\u5177\uff08\u5982 top \u6216 htop\uff09\u6aa2\u67e5\u4f3a\u670d\u5668\u7684\u5167\u5b58\u548c CPU \u4f7f\u7528\u60c5\u6cc1\u3002\u5982\u679c\u8cc7\u6e90\u4e0d\u8db3\uff0c\u8003\u616e\u5347\u7d1a\u4f3a\u670d\u5668\u6216\u91cb\u653e\u4e0d\u5fc5\u8981\u7684\u8cc7\u6e90\u3002<\/p>\n<h3 id=\"3-%e4%bf%ae%e5%be%a9%e6%95%b8%e6%93%9a%e6%90%8d%e5%a3%9e-HyOUfdbwZN\">3. \u4fee\u5fa9\u6578\u64da\u640d\u58de<\/h3>\n<p>\u5982\u679c\u61f7\u7591\u6578\u64da\u5eab\u6587\u4ef6\u640d\u58de\uff0c\u53ef\u4ee5\u4f7f\u7528\u6578\u64da\u5eab\u63d0\u4f9b\u7684\u4fee\u5fa9\u5de5\u5177\u3002\u4f8b\u5982\uff0c\u5c0d\u65bc MySQL\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4fee\u5fa9\u8868\uff1a<\/p>\n<pre><code>REPAIR TABLE table_name;<\/code><\/pre>\n<p>\u5c0d\u65bc PostgreSQL\uff0c\u53ef\u4ee5\u4f7f\u7528 pg_dump \u9032\u884c\u5099\u4efd\uff0c\u7136\u5f8c\u91cd\u5efa\u6578\u64da\u5eab\u3002<\/p>\n<h3 id=\"4-%e6%aa%a2%e6%9f%a5%e7%ab%af%e5%8f%a3%e8%a1%9d%e7%aa%81-HyOUfdbwZN\">4. \u6aa2\u67e5\u7aef\u53e3\u885d\u7a81<\/h3>\n<p>\u4f7f\u7528 netstat \u547d\u4ee4\u6aa2\u67e5\u6578\u64da\u5eab\u6240\u9700\u7684\u7aef\u53e3\u662f\u5426\u88ab\u5176\u4ed6\u61c9\u7528\u7a0b\u5e8f\u4f54\u7528\uff1a<\/p>\n<pre><code>netstat -tuln | grep 3306<\/code><\/pre>\n<p>\u5982\u679c\u767c\u73fe\u7aef\u53e3\u88ab\u4f54\u7528\uff0c\u53ef\u4ee5\u8003\u616e\u66f4\u6539\u6578\u64da\u5eab\u7684\u7aef\u53e3\u8a2d\u7f6e\u6216\u505c\u6b62\u4f54\u7528\u8a72\u7aef\u53e3\u7684\u61c9\u7528\u7a0b\u5e8f\u3002<\/p>\n<h3 id=\"5-%e7%a2%ba%e4%bf%9d%e6%9c%8d%e5%8b%99%e5%95%9f%e5%8b%95-HyOUfdbwZN\">5. \u78ba\u4fdd\u670d\u52d9\u555f\u52d5<\/h3>\n<p>\u6700\u5f8c\uff0c\u6aa2\u67e5\u6578\u64da\u5eab\u670d\u52d9\u662f\u5426\u6b63\u5728\u904b\u884c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u670d\u52d9\u72c0\u614b\uff1a<\/p>\n<pre><code>systemctl status mysql<\/code><\/pre>\n<p>\u5982\u679c\u670d\u52d9\u672a\u555f\u52d5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5\u670d\u52d9\uff1a<\/p>\n<pre><code>systemctl start mysql<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-HyOUfdbwZN\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u555f\u52d5\u7684\u554f\u984c\u53ef\u80fd\u7531\u591a\u7a2e\u56e0\u7d20\u5f15\u8d77\uff0c\u5305\u62ec\u914d\u7f6e\u932f\u8aa4\u3001\u8cc7\u6e90\u4e0d\u8db3\u3001\u6578\u64da\u640d\u58de\u7b49\u3002\u901a\u904e\u6aa2\u67e5\u914d\u7f6e\u6587\u4ef6\u3001\u7cfb\u7d71\u8cc7\u6e90\u3001\u6578\u64da\u5b8c\u6574\u6027\u3001\u7aef\u53e3\u885d\u7a81\u53ca\u670d\u52d9\u72c0\u614b\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u6c7a\u9019\u4e9b\u554f\u984c\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u53ef\u7528\u6027\u548c\u7a69\u5b9a\u6027\u7684\u696d\u52d9\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u6216 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u89e3\u6c7a\u65b9\u6848\u81f3\u95dc\u91cd\u8981\uff0c\u4ee5\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u6b63\u5e38\u904b\u884c\u548c\u696d\u52d9\u7684\u6301\u7e8c\u904b\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u8a0e\u6578\u64da\u5eab\u4f3a\u670d\u5668\u4e0d\u555f\u52d5\u7684\u539f\u56e0\u53ca\u53ef\u80fd\u7684\u89e3\u6c7a\u65b9\u6cd5\uff0c\u5e6b\u52a9\u7528\u6236\u5feb\u901f\u6392\u67e5\u548c\u4fee\u5fa9\u4f3a\u670d\u5668\u904b\u884c\u554f\u984c\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-186522","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186522","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=186522"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186522\/revisions"}],"predecessor-version":[{"id":186523,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186522\/revisions\/186523"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=186522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=186522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=186522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}