日期:2014-05-16  浏览次数:20898 次

Linux出现java.net.SocketException: Too many open files解决方法
[root@fwang5stash ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7167
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
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7167
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

?

1.临时修改

[root@fwang5stash ~]# ulimit -n 8192

?

2.永久修改

修改/etc/security/limits.conf 添加如下一行:
* - nofile 8192

修改/etc/pam.d/login添加如下一行
session required /lib/security/pam_limits.so

重新登录后生效

?