我有一个Ubuntu 16.04服务器。
当我作为root运行, ulimit -n我得到1024。
当我运行它作为我的用户,我得到65535。
但是我想确保包括root在内的所有用户都将打开的文件限制设置为65535。
问题是,我已经做了我所知道的一切来改变它,仍然为root显示1024。
以下是我所做的事情:
root@sensu:/etc/security/limits.d# cat 90-nofiles.conf * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard nofile 65535 root@sensu:/etc/security# grep nofile limits.conf # - nofile - max number of open files * soft nofile 65535 * hard nofile 65535 root@sensu:/etc/security# grep file-max /etc/sysctl.conf fs.file-max = 65536
当然我运行sysctl -p 。
有问题的过程是redis:
root@sensu:/proc# grep "open files" /proc/1487/limits Max open files 4096 4096 files
查看redis init文件:
root@sensu:/proc# grep ulimit /etc/init.d/redis-server ulimit -n 100001
正如你在例子中看到的,这个限制没有理由是1024,而且还是1024。
可能是什么原因? 那个设置在哪里,我错过了?
我在这个计算器发现了答案。
这似乎是添加:
* soft nofile 65535 * hard nofile 65535
编辑非root用户的限制时就足够了。
但为了更改root用户的限制,还必须明确添加:
root soft nofile 65535 root hard nofile 65535
现在它按预期工作:
root@sensu:~# ulimit -n 65535