我试图在 etc/security/limits.conf
中设置 Ubuntu 中打开文件的最大数量的值,但是当我触发命令 时,我没有得到相同的值>ulimit -a
。
我在 limits.conf 中添加以下值:
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
但是在触发 ulimit -a
时,我得到:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 139264
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 30048
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 139264
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
最佳答案
如果您的服务由 systemd 管理,那么您需要使用以下内容更新您的服务文件
LimitNOFILE=32768
例如tomcat.服务
关于tomcat - 设置最大文件数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22961087/