提高Linux上系统范围内的RLIMIT_NOFILE的硬限制 [英] Raising hard limit on RLIMIT_NOFILE system-wide on Linux
问题描述
运行memcached时,我们需要提高RLIMIT_NOFILE,因为我们要达到默认的硬限制(1024).但是,提高硬限制需要root,并且由于各种原因,我们不想以root身份运行memcached或其包含的shell.现在,我们很高兴以非root用户身份运行它.
We need to raise RLIMIT_NOFILE when running memcached, as we're hitting the default hard limit (1024). However, raising a hard limit requires root, and for various reasons we don't want to have to run memcached or its containing shell as root. Right now we happily run it as a non-root user.
是否有办法提高系统范围内RLIMIT_NOFILE的硬限制,以便我们可以继续以非root用户身份运行memcached并简单地提高软限制?
Is there a way to raise the hard limit for RLIMIT_NOFILE system-wide, so that we can continue to run memcached as non-root and simply raise the soft limit?
这是具有2.6内核的RedHat Linux.
This is RedHat Linux with 2.6 kernel.
谢谢!
乔恩
推荐答案
您可以使用以下语法在/etc/security/limits.conf中设置限制:
You can set the limits in /etc/security/limits.conf with the syntax:
<domain> <type> <item> <value>
<域> 可以是用户(即内存缓存)或组.
The <domain> can be a user (i.e. memcache) or a group.
这篇关于提高Linux上系统范围内的RLIMIT_NOFILE的硬限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!