{"id":289633,"date":"2024-01-24T05:14:16","date_gmt":"2024-01-23T21:14:16","guid":{"rendered":"https:\/\/lrxjmw.cn\/ljbgltsxtxnd.html"},"modified":"2024-01-24T05:14:16","modified_gmt":"2024-01-23T21:14:16","slug":"ljbgltsxtxnd","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ljbgltsxtxnd.html","title":{"rendered":"Linux\u53e5\u67c4\u7ba1\u7406\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u7ec8\u6781\u79d8\u7c4d"},"content":{"rendered":"

\u60a8\u597d\uff01\u6211\u4eec\u4eca\u5929\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u8ba1\u7b97\u673a\u5b9e\u7528\u5c0f\u6280\u5de7\u2014\u2014\u53e5\u67c4\u6570\u3002\u8fd9\u662f\u64cd\u4f5c\u7cfb\u7edf<\/a>\u9ad8\u6548\u7ba1\u7406\u5404\u79cd\u8d44\u6e90\uff08\u5982\u6b63\u5728\u6d4f\u89c8\u7684\u6587\u4ef6\u3001\u8bbf\u95ee\u8fc7\u7684\u7f51\u7ad9\u53ca\u6b63\u5728\u6267\u884c\u7684\u4efb\u52a1\u7b49\uff09\u7684\u91cd\u8981\u5de5\u5177\u3002\u4f46\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53e5\u67c4\u6570\u589e\u957f\u8fc7\u5ea6linux\u67e5\u770b\u786c\u4ef6\u4fe1\u606f\uff0c\u5c06\u4f1a\u5f71\u54cd\u5230\u6574\u4e2a\u7cfb\u7edf\u7684\u6027\u80fd\uff0c\u751a\u81f3\u53ef\u80fd\u5bfc\u81f4\u90e8\u5206\u5e94\u7528\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n

\u4eb2\u7231\u7684\u670b\u53cb\uff0c\u60a8\u597d\uff01\u8fd9\u5c31\u5411\u60a8\u63a8\u8350\u4e00\u79cd\u7b80\u6613\u4e14\u884c\u4e4b\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6848\u2014\u2014\u501f\u52a9Linux<\/a>\u5f3a\u5927\u7684\u53e5\u67c4\u7ba1\u7406\u80fd\u529b\uff0c\u5b9e\u73b0\u8d44\u6e90\u7684\u7cbe\u51c6\u5316\u8c03\u5ea6\uff0c\u4ee5\u63d0\u9ad8\u7cfb\u7edf\u6574\u4f53\u6027\u80fd\u53ca\u964d\u4f4e\u7f51\u7edc\u5ef6\u8fdf\u3002<\/p>\n

\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

1.\u67e5\u770b\u5f53\u524d\u53e5\u67c4\u6570<\/b><\/p>\n

\u4eb2\u7231\u7684\u7528\u6237\uff0c\u8bf7\u60a8\u7559\u610f\u7cfb\u7edf\u4e2d`handle`\u6570\u76ee\u7684\u53d8\u5316\u54e6\uff01\u7b80\u5355\u5730\u5728\u63a7\u5236\u53f0\u8f93\u5165\u76f8\u5173\u547d\u4ee4<\/a>\u5373\u53ef\u67e5\u770b\u5230\u5177\u4f53\u60c5\u51b5\u5566\u3002<\/p>\n

```<\/p>\n

cat \/proc\/sys\/fs\/file-nr<\/p>\n

\u8c22\u8c22\u60a8\u5bf9\u6211\u4eec\u7684\u56de\u5e94\u7ed9\u4e88\u5982\u6b64\u7684\u91cd\u89c6\u3002\u6211\u60f3\u5411\u60a8\u5206\u4eab\u6b64\u6b21\u53cd\u5e94\u4e2d\u6d89\u53ca\u5230\u7684\u4e09\u4e2a\u65b9\u9762\u7684\u60c5\u51b5\uff1a\u4e00\u662f\u65e0\u6307\u5411\u6b63\u5728\u4f7f\u7528\u7684\u6587\u4ef6\u603b\u91cf\uff1b\u4e8c\u662f\u4ece\u672a\u4f7f\u7528\u8fc7\u4f46\u4ecd\u7136\u4fdd\u6301\u6548\u7528\u7684\u6587\u4ef6\u6570\u636e\uff1b\u6700\u540e\u5219\u662f\u672c\u7cfb\u7edf\u6240\u5141\u8bb8\u5b58\u50a8\u7684\u6587\u4ef6\u6570\u91cf\u4e0a\u9650\u3002\u5e0c\u671b\u8fd9\u4e9b\u6570\u636e\u80fd\u5e2e\u5230\u60a8\u3002<\/p>\n

linux\u6587\u4ef6\u53e5\u67c4\u91ca\u653e_linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570_linux\u5f3a\u5236\u91ca\u653e\u7aef\u53e3<\/p>\n

2.\u4fee\u6539\u7cfb\u7edf\u9650\u5236<\/b><\/p>\n

\u5c0a\u656c\u7684\u7528\u6237\uff0c\u82e5\u9047\u5230\u53e5\u67c4\u6570\u91cf\u63a5\u8fd1\u6216\u8d85\u51fa\u6700\u5927\u914d\u7f6e\u6587\u4ef6\u53e5\u67c4\u9650\u5236\u7684\u95ee\u9898\uff0c\u4e3a\u6ee1\u8db3\u73b0\u65f6\u548c\u672a\u6765\u9700\u6c42\uff0c\u6073\u8bf7\u60a8\u5728\u547d\u4ee4\u884c\u754c\u9762\u5c1d\u8bd5\u4ee5\u4e0b\u8c03\u8282\u3002<\/p>\n

\u795d\u60a8\u597d\u8fd0\u4fee\u6539:\/etc\/security\/limits.conf\u914d\u7f6elinux\u8fd0\u7ef4\u9762\u8bd5\u9898\uff0c\u4e07\u4e8b\u5982\u610f\uff01<\/p>\n

\u5728\u6253\u5f00\u7684\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4e24\u884c\u5185\u5bb9\uff1a<\/p>\n

* soft nofile 65535<\/p>\n

* hard nofile 65535<\/p>\n

linux\u6587\u4ef6\u53e5\u67c4\u91ca\u653e_linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570_linux\u5f3a\u5236\u91ca\u653e\u7aef\u53e3<\/p>\n

\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u4ef6\u3002<\/p>\n

3.\u4fee\u6539\u8fdb\u7a0b\u9650\u5236<\/b><\/p>\n

\u8bf7\u5728\u91cd\u542f\u7ec8\u7aef\u540e\uff0c\u5bc6\u5207\u7559\u610f\u5e76\u6839\u636e\u9700\u8981\u81ea\u884c\u8c03\u6574\u6bcf\u4e2a\u6d41\u7a0b\u7684\u53e5\u67c4\u9971\u548c\u5ea6\u3002\u4e0b\u9762\u9644\u6709\u8be6\u7ec6\u7684\u4f7f\u7528\u8bf4\u660e\u548c\u64cd\u4f5c\u6b65\u9aa4\uff0c\u6073\u8bf7\u60a8\u7ec6\u5fc3\u9075\u5faa\u6765\u5b8c\u6210\u8fd9\u9879\u4efb\u52a1\u3002<\/p>\n

sudo vi \/etc\/sysctl.conf<\/p>\n

\u5728\u6253\u5f00\u7684\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u4e00\u884c\u5185\u5bb9\uff1a<\/p>\n

fs.file-max = 65535<\/p>\n

4.\u91cd\u542f\u7cfb\u7edf<\/b><\/p>\n

\u8bf7\u60a8\u91cd\u542f\u7cfb\u7edf\u4ee5\u6fc0\u6d3b\u4fee\u6539\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e0b\u9762\u7684\u6307\u4ee4\u5373\u53ef\uff1a<\/p>\n

sudo reboot<\/p>\n

5.\u9a8c\u8bc1\u8bbe\u7f6e\u662f\u5426\u751f\u6548<\/b><\/p>\n

\u5c0a\u656c\u7684\u7528\u6237\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85\u6570\u5206\u949f\uff0c\u7cfb\u7edf\u5c06\u91cd\u65b0\u542f\u52a8\u5e76\u663e\u793a\u53e5\u67c4\u6570\u636e\u3002\u82e5\u9700\u67e5\u8be2\u8be5\u4fe1\u606f\uff0c\u60a8\u53ef\u4ee5\u5728\u63a7\u5236\u53f0\u4e2d\u952e\u5165\u76f8\u5173\u6307\u4ee4\u8fdb\u884c\u67e5\u770b\u3002<\/p>\n

6.\u4f7f\u7528 ulimit \u547d\u4ee4<\/b><\/p>\n

linux\u6587\u4ef6\u53e5\u67c4\u91ca\u653e_linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570_linux\u5f3a\u5236\u91ca\u653e\u7aef\u53e3<\/p>\n

\u5982\u60a8\u5e0c\u671b\u804a\u5929\u5ba4\u5185\u80fd\u5c3d\u5feb\u589e\u52a0\u53d1\u8a00\u4e0a\u9650\uff0c\u5efa\u8bae\u4f7f\u7528\"utilt\"\u6307\u4ee4\u3002\u53ea\u9700\u5728\u9762\u677f\u4e2d\u8f93\u5165\u8be5\u547d\u4ee4\u5373\u53ef\u5b9e\u73b0\u6b64\u76ee\u7684\u3002<\/p>\n

ulimit -n 65535<\/p>\n

7.\u76d1\u63a7\u53e5\u67c4\u6570<\/b><\/p>\n

\u4eb2\u7231\u7684\u7528\u6237\u60a8\u597d\uff0c\u4e3a\u4e86\u5e2e\u52a9\u60a8\u66f4\u6df1\u5165\u5730\u7406\u89e3\u7cfb\u7edf\u8fd0\u884c\u60c5\u51b5linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570<\/strong>linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570<\/strong>\uff0c\u6211\u4eec\u5f3a\u70c8\u63a8\u8350\u60a8\u4f7f\u7528\u9002\u5b9c\u7684\u76d1\u63a7\u5de5\u5177\uff0c\u5982Sysstat\u4e2d\u7684sar\u547d\u4ee4\uff0c\u6765\u8fdb\u884c\u53e5\u67c4\u6570\u7684\u5b9e\u65f6\u76d1\u6d4b\u3002\u4e0b\u9762\u4e3a\u60a8\u63d0\u4f9b\u8be6\u7ec6\u7684\u5b89\u88c5\u53ca\u914d\u7f6e\u6307\u5357\uff1a<\/p>\n

sudo apt-get install sysstat<\/p>\n

\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b9e\u65f6\u76d1\u63a7\u53e5\u67c4\u6570\u7684\u53d8\u5316\uff1a<\/p>\n

linux\u5f3a\u5236\u91ca\u653e\u7aef\u53e3_linux\u6587\u4ef6\u53e5\u67c4\u91ca\u653e_linux \u5f3a\u5236\u91ca\u653e\u53e5\u67c4\u6570<\/p>\n

sar -v 1<\/p>\n

8.\u6ce8\u610f\u4e8b\u9879<\/b><\/p>\n

\u5728\u8fdb\u884c\u53e5\u67c4\u6570\u8c03\u6574\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n

-\u4fee\u6539\u7cfb\u7edf\u548c\u8fdb\u7a0b\u9650\u5236\u9700\u8981root\u6743\u9650\uff1b<\/p>\n

-\u4fee\u6539\u7cfb\u7edf\u9650\u5236\u540e\u9700\u8981\u91cd\u542f\u7cfb\u7edf\uff1b<\/p>\n

\u656c\u544a\uff1a\u8bf7\u6ce8\u610f\u76ee\u524d\u53e5\u67c4\u6570\u91cf\u53ef\u80fd\u5bf9\u7cfb\u7edf\u8d44\u6e90\u9020\u6210\u538b\u529b\uff0c\u5982\u6709\u5fc5\u8981\uff0c\u6073\u8bf7\u60a8\u9002\u65f6\u8c03\u6574\u64cd\u4f5c\u6a21\u5f0f\u4e0e\u64cd\u4f5c\u91cf\u3002<\/p>\n

\u5c0a\u656c\u7684\u5404\u4f4d\uff0c\u6211\u5728\u6b64\u5206\u4eab\u516b\u6b65\u8c03\u7528\u6cd5\uff0c\u5e0c\u671b\u80fd\u591f\u907f\u514d\u7531\u4e8e\u7cfb\u7edf\u53e5\u67c4\u5bfc\u81f4\u7684\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\u8fdf\u7f13\u7684\u72b6\u51b5\u3002\u671f\u5f85\u6211\u7684\u5efa\u8bae\u80fd\u5e2e\u5230\u60a8\uff0c\u795d\u60a8\u7f16\u7a0b\u4e4b\u8def\u7545\u5feb\u65e0\u8bef\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4f46\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53e5\u67c4\u6570\u589e\u957f\u8fc7\u5ea6\uff0c\u5c06\u4f1a\u5f71\u54cd\u5230\u6574\u4e2a\u7cfb\u7edf\u7684\u6027\u80fd\uff0c\u751a\u81f3\u53ef\u80fd\u5bfc\u81f4\u90e8\u5206\u5e94\u7528\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002\u8fd9\u5c31\u5411\u60a8\u63a8\u8350\u4e00\u79cd\u7b80\u6613\u4e14\u884c\u4e4b\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6848\u2014\u2014\u501f\u52a9Linux\u5f3a\u5927\u7684\u53e5\u67c4\u7ba1\u7406\u80fd\u529b\uff0c\u5b9e\u73b0\u8d44\u6e90\u7684\u7cbe\u51c6\u5316\u8c03\u5ea6\uff0c\u4ee5\u63d0\u9ad8\u7cfb\u7edf\u6574\u4f53\u6027\u80fd\u53ca\u964d\u4f4e\u7f51\u7edc\u5ef6\u8fdf\u3002<\/p>\n","protected":false},"author":1,"featured_media":289634,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-289633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/289633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=289633"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/289633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/289634"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=289633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=289633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=289633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}