我们拥有本地和托管在Azure中的Ubuntu 12.04 LTS服务器。虽然我们可以更改交互式登录用户的文件限制,但似乎默认情况下,由init.d启动的服务的硬打开文件限制为4096。虽然我们可以使用upstart并为特定服务设置更高的限制,但这不会例如,Hortonworks HDP并不能帮助我们,Hortonworks HDP使用自己的机制来运行各种服务。我要的是改变了整个系统的默认打开文件限制一切。我们该怎么做?
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设置。其他一些程序仅使用系统或自动启动设置。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句