歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 關於Ubuntu 14.04下ulimit的限制問題

關於Ubuntu 14.04下ulimit的限制問題

日期:2017/2/28 13:49:37   编辑:Linux教程

Linux對於每個用戶,系統限制其最大進程數。為提高性能,可以根據設備資源情況,設置各linux 用戶的最大進程數。
可以使用ulimit -a查看當前限制:

對於一些服務的資源限制,如mongodb最大連接數限制等,常用的解決方法是:
#ulimit -u 64000
#ulimit -s 1024
#ulimit -n 64000

但這些命令都是當次有效的。

可以修改相應配置文件,使之永久有效
#sudo vim /etc/security/limits.conf
* hard nofile 64000
* soft nofile 64000
root hard nofile 64000
root soft nofile 64000
* hard nproc 64000
* soft nproc 64000
root hard nproc 64000
root soft nproc 64000
* hard stack 1024
* soft stack 1024
root hard stack 1024
root soft stack 1024

重啟後生效。
如果ulimit -a查看時,max user processes 沒有生效,可以添加一個文件
#sudo vim /etc/security/limits.d/90-nproc.conf
* hard nproc 64000
* soft nproc 64000
root hard nproc 64000
root hard nproc 64000

Copyright © Linux教程網 All Rights Reserved