【问题标题】:How to change *default* open-file limit on Ubuntu 12.4如何在 Ubuntu 12.4 上更改 *default* 打开文件限制
【发布时间】:2015-09-29 23:20:14
【问题描述】:
我们拥有本地和托管在 Azure 中的 Ubuntu 12.04 LTS 服务器。
虽然我们可以更改交互式登录用户的文件限制,但似乎默认情况下,由 init.d 启动的服务的硬打开文件限制为 4096。虽然我们可以使用 upstart 并为特定服务设置更高的限制,但这并没有比如说,Hortonworks HDP 对我们没有帮助,它使用自己的机制运行各种服务。我想要的是更改 everything 的系统范围默认打开文件限制。我们如何做到这一点?
【问题讨论】:
标签:
azure
ubuntu-12.04
ulimit
【解决方案1】:
1.检查系统范围的设置:/etc/security/limits.conf
一个非常没有限制的配置文件:
* soft nofile 102400
* hard nofile 102400
* soft nproc 102400
* hard nproc 102400
root hard nofile 102400
root soft nofile 102400
2。检查程序自动启动脚本及其设置
程序自动启动脚本有点不同,它有自己的设置,或者会使用默认的1024。
示例:程序主管(在 Ubuntu 12/14 上测试)
/etc/init.d/supervisor - auto startup script
/etc/init/supervisor.conf - auto startup script settings
您可以在 /etc/init.d/supervisor 中添加 ulimit 命令来设置限制,或者只是在 /etc/init/ 中添加限制设置supervisor.conf。 /etc/init/supervisor.conf 示例:
limit nofile 102400 102400
3.检查程序特定设置
某些程序有其自身的限制。与 supervisor 一样,它有自己的文件/进程限制,因此您还必须在其配置文件 /etc/supervisor/supervisord.conf 中添加 minfds 和 minprocs 设置。其他一些程序只是使用系统或自动启动设置。