cat /proc/39977/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 65535 65535 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 514823 514823 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
上面的展示是查看某个进程的打开文件的相关参数最大值,其中,Max open files 是打开文件的最大数量,那么如何动态修改这个值呢? 毕竟1024太小了,操作如下:
# CentOS7系统使用命令
prlimit --nofile=65536:65536 --pid 39977
# CentOS6系统使用命令
echo - n "Max open files=65535:65535" > /proc/39977/limits
当然,可以通过重启这个进程所对应的服务(如果可重启,也不会来修改这个session里的参数了)来重新读取系统里的默认设置。
扩展:
ulimit -n
# 临时修改,重启失效
ulimit -HSn 65536
# 永久解决
vim /etc/security/limits.conf
# 添加如下的行
* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536
标签:limits,Max,unlimited,bytes,pids,proc,65536,size
From: https://www.cnblogs.com/linhaostudy/p/17821872.html