{"id":101243,"date":"2024-07-30T22:37:12","date_gmt":"2024-07-30T14:37:12","guid":{"rendered":"https:\/\/gulass.cn\/?p=101243"},"modified":"2024-07-30T22:37:12","modified_gmt":"2024-07-30T14:37:12","slug":"ulimit-order-details","status":"publish","type":"post","link":"https:\/\/gulass.cn\/ulimit-order-details.html","title":{"rendered":"CentOS 6.5\u4e3a\u4f8b ulimit\u547d\u4ee4\u8be6\u89e3"},"content":{"rendered":"
ulimit\u7528\u6765\u9650\u5236\u6bcf\u4e2a\u7528\u6237\u53ef\u4f7f\u7528\u7684\u8d44\u6e90\uff0c\u5982CPU\u3001\u5185\u5b58\u3001\u53e5\u67c4\u7b49\u3002\u4e0b\u9762\u4ee5CentOS 6.5\u4e3a\u4f8b\u8fdb\u884c\u603b\u7ed3\u3002<\/p>\n
\u547d\u4ee4\u683c\u5f0f\uff1a<\/p>\n
ulimit<\/span> [-SHacdefilmnpqrstuvx]\r\n<\/pre>\n\n- \u53c2\u6570S<\/span> \uff1a\u8868\u793a\u8f6f\u9650\u5236\uff0c\u5f53\u8d85\u8fc7\u9650\u5236\u503c\u4f1a\u62a5\u8b66<\/li>\n
- \u53c2\u6570H<\/span>\uff1a\u8868\u793a\u786c\u9650\u5236\uff0c\u5fc5\u5b9a\u4e0d\u80fd\u8d85\u8fc7\u9650\u5236\u503c<\/li>\n
- \u53c2\u6570a<\/span> \uff1a\u5c06\u5217\u51fa\u6240\u6709\u8d44\u6e90\u9650\u5236\uff0c\u5982\uff1a<\/li>\n<\/ul>\n
<\/a><\/p>\n\n- \u53c2\u6570c<\/span> \uff1a\u5f53\u67d0\u4e9b\u7a0b\u5e8f\u53d1\u751f\u9519\u8bef\u65f6\uff0c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u5c06\u8be5\u7a0b\u5e8f\u5728\u5185\u5b58\u4e2d\u7684\u4fe1\u606f\u5199\u6210\u6587\u4ef6(\u9664\u9519\u7528)\uff0c\u8fd9\u79cd\u6587\u4ef6\u5c31\u88ab\u79f0\u4e3a\u6838\u5fc3\u6587\u4ef6(core file)\u3002\u6b64\u4e3a\u9650\u5236\u6bcf\u4e2a\u6838\u5fc3\u6587\u4ef6\u7684\u6700\u5927\u5bb9\u91cf<\/li>\n
- \u53c2\u6570d<\/span> \uff1a\u6bcf\u4e2a\u8fdb\u7a0b\u6570\u636e\u6bb5\u7684\u6700\u5927\u503c<\/li>\n
- \u53c2\u6570f<\/span> \uff1a\u5f53\u524dshell\u53ef\u521b\u5efa\u7684\u6700\u5927\u6587\u4ef6\u5bb9\u91cf<\/li>\n
- \u53c2\u6570l<\/span> \uff1a\u53ef\u4ee5\u9501\u5b9a\u7684\u7269\u7406\u5185\u5b58\u7684\u6700\u5927\u503c<\/li>\n
- \u53c2\u6570m<\/span> \uff1a\u53ef\u4ee5\u4f7f\u7528\u7684\u5e38\u9a7b\u5185\u5b58\u7684\u6700\u5927\u503c<\/li>\n
- \u53c2\u6570n<\/span> \uff1a\u6bcf\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u540c\u65f6\u6253\u5f00\u7684\u6700\u5927\u6587\u4ef6\u53e5\u67c4\u6570<\/li>\n
- \u53c2\u6570p<\/span> \uff1a\u7ba1\u9053\u7684\u6700\u5927\u503c<\/li>\n
- \u53c2\u6570s<\/span> \uff1a\u5806\u6808\u7684\u6700\u5927\u503c<\/li>\n
- \u53c2\u6570t<\/span> \uff1a\u6bcf\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u4f7f\u7528CPU\u7684\u6700\u5927\u65f6\u95f4<\/li>\n
- \u53c2\u6570u<\/span> \uff1a\u6bcf\u4e2a\u7528\u6237\u8fd0\u884c\u7684\u6700\u5927\u8fdb\u7a0b\u5e76\u53d1\u6570<\/li>\n
- \u53c2\u6570v<\/span> \uff1a\u5f53\u524dshell\u53ef\u4f7f\u7528\u7684\u6700\u5927\u865a\u62df\u5185\u5b58<\/li>\n<\/ul>\n2 \u4fee\u6539ulimit<\/strong><\/div>\n
\u547d\u4ee4\u683c\u5f0f\uff1a<\/p>\n
ulimit<\/span> [-SHcdefilmnpqrstuvx] [limit<\/span>]\r\n<\/pre>\n\u5728\u67e5\u770b\u7684\u547d\u4ee4\u540e\u9762\u52a0\u4e0a\u9650\u5236\u503c\uff0c\u5c31\u53ef\u4ee5\u8c03\u6574\u67d0\u4e00\u9879\u9650\u5236\uff0c\u4f46\u53ea\u5bf9\u5f53\u524d\u767b\u5f55shell\u6709\u6548\u3002<\/p>\n
\u53c2\u6570S<\/span>\u8868\u793a\u8bbe\u7f6e\u8f6f\u9650\u5236\uff1b\u53c2\u6570H<\/span>\u8868\u793a\u8bbe\u7f6e\u786c\u9650\u5236\uff1b\u5f53\u90fd\u4e0d\u6307\u5b9a\u65f6\uff0c\u8868\u793a\u8bbe\u7f6e\u8f6f\u9650\u5236\u548c\u786c\u9650\u5236\u5747\u4e3a\u6307\u5b9a\u503c\u3002<\/p>\n3 \u6c38\u4e45\u4fee\u6539ulimit<\/strong><\/div>\n\u6240\u8c13\u6c38\u4e45\uff0c\u662f\u6307\u6bcf\u6b21\u767b\u9646shell\u65f6\uff0c\u90fd\u4f1a\u6309\u914d\u7f6e\u91cd\u65b0\u8bbe\u5b9aulimit<\/span> \uff0c\u4ee5\u8fbe\u5230\u6c38\u4e45\u751f\u6548\u7684\u6548\u679c\u3002<\/p>\n\n- \u6b65\u9aa4\u4e00\uff1a\u4fee\u6539\/etc\/security\/limits.conf<\/span><\/li>\n<\/ul>\n
\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n
\u5173\u4e8e\u8be5\u6587\u4ef6\u7684\u914d\u7f6e\u65b9\u5f0f\u8bf7\u53c2\u8003\u540e\u6587<\/em><\/p>\n[root@CentOS646506 ~]# vim \/etc\/security\/limits.conf\r\n* <\/span>hard nproc 64000\r\n* <\/span>soft nproc 64000\r\n* <\/span>hard nofile 64000\r\n* <\/span>soft nofile 64000\r\n<\/pre>\n\u4ee5\u4e0a\u5185\u5bb9\u8868\u793a\uff0c\u5c06-u<\/span> \u548c-n<\/span> \u7684\u8f6f\u9650\u5236\u548c\u786c\u9650\u5236\u540c\u65f6\u4fee\u6539\u4e3a64000\u3002<\/p>\n\n- \u6b65\u9aa4\u4e8c\uff1a\u4fee\u6539\/etc\/pam.d\/login<\/li>\n<\/ul>\n
\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n
[root@CentOS646506<\/span> ~]# vim \/etc\/pam.d\/login<\/span>\r\nsession required pam_limits.so\r\n<\/pre>\n\u4ee5\u4e0a\u5185\u5bb9\u8868\u793a\uff0c\u5728\u767b\u5f55\u65f6\u4f7f\u7528pam<\/span> \u7ba1\u7406limit<\/span> \u3002<\/p>\n\n- \u6b65\u9aa4\u4e09\uff1a\u4fee\u6539\/etc\/profile<\/li>\n<\/ul>\n
\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9<\/p>\n
[root@CentOS646506 ~]# vim \/etc\/profile<\/span>\r\nulimit<\/span> -u 64000\r\nulimit<\/span> -n 64000\r\n<\/pre>\n\u6bcf\u6b21\u767b\u9646shell\u540e\uff0c\u4f1a\u521d\u59cb\u6267\u884c\u8fd9\u4e24\u6761ulimit<\/span> \u547d\u4ee4\uff0c\u5e76\u4f7f\u5176\u751f\u6548\u3002<\/p>\n\n- \u6b65\u9aa4\u56db\uff1a\u4f7f\u914d\u7f6e\u751f\u6548<\/li>\n<\/ul>\n
\u91cd\u65b0\u767b\u5f55\u6216\u4f7f\u7528source \/etc\/profile<\/span> \u7acb\u5373\u751f\u6548\u3002<\/p>\nsource\u4f7f\u5f53\u524dshell\u5bf9\u6307\u5b9a\u6587\u4ef6\u5185\u5bb9\u751f\u6548\u3002<\/em><\/p>\n3.1 \/etc\/security\/limits.conf\u914d\u7f6e\u8be6\u89e3<\/strong><\/span><\/div>\n\u683c\u5f0f\uff1a<\/p>\n
<domain<\/span>><\/span> <type<\/span>><\/span> <item<\/span>><\/span> <value<\/span>><\/span>\r\n<\/pre>\n\n- domain<\/span> \u662f\u6307\u751f\u6548\u5b9e\u4f53\n
\n- \u7528\u6237\u540d<\/li>\n
- \u4e5f\u53ef\u4ee5\u901a\u8fc7@group<\/span> \u6307\u5b9a\u7528\u6237\u7ec4<\/li>\n
- \u4f7f\u7528*<\/span> \u8868\u793a\u9ed8\u8ba4\u503c<\/li>\n<\/ul>\n<\/li>\n
- type<\/span> \u6307\u9650\u5236\u7c7b\u578b\n
\n- soft<\/span> \u8f6f\u9650\u5236<\/li>\n
- hard<\/span> \u786c\u9650\u5236<\/li>\n<\/ul>\n<\/li>\n
- item<\/span>\u9650\u5236\u8d44\u6e90\n
\n- core\u540culimit -c<\/span><\/li>\n
- data\u540culimit -d<\/span><\/li>\n
- fsize\u540culimit -f<\/span><\/li>\n
- memloc\u540culimit -l<\/span><\/li>\n
- nofile\u540culimit -n<\/span><\/li>\n
- stack\u540culimit -s<\/span><\/li>\n
- cpu \u540culimit -t<\/span><\/li>\n
- nproc\u540culimit -u<\/span><\/li>\n
- maxlogins\u6307\u5b9a\u7528\u6237\u53ef\u4ee5\u540c\u65f6\u767b\u9646\u7684\u6570\u91cf<\/li>\n
- maxsyslogins\u7cfb\u7edf\u53ef\u4ee5\u540c\u65f6\u767b\u9646\u7684\u7528\u6237\u6570<\/li>\n
- priority\u7528\u6237\u8fdb\u7a0b\u8fd0\u884c\u7684\u4f18\u5148\u7ea7<\/li>\n
- locks\u7528\u6237\u53ef\u4ee5\u9501\u5b9a\u7684\u6587\u4ef6\u6700\u5927\u503c<\/li>\n
- sigpengding\u540culimit -i<\/span><\/li>\n
- msgqueue\u540culimit -q<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/my.oschina.net\/xlyslr\/blog\/1796028<\/a><\/p>\n