有时候在程序里面需要打开多个文件,进行分析,系统一般默认数量是1024,(用ulimit -a可以看到)对于正常使用是够了,但是对于程序来讲,就太少了。修改办法:重启就OK修改2个文件。
1./etc/security/limits.conf
vi /etc/security/limits.conf
加上:
* soft nofile 65535
* hard nofile 65535
2./etc/pam.d/login
session required /lib/security/pam_limits.so
ulimit -a查看 下 OK
查看open files 的大小
[root@web2 ~]# 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) 69632
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
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) 69632
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
转载于:https://blog.51cto.com/lxplwh/1272830