修改Linux系统的open files连接数
方法一:
[root@i-iivphroy ~]# cat /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
其中nofile对应open_files
nproc对应max_user_processes
但是在Linux 6.4之后,如果只修改了该文件中的nproc,那么其他非root用户对应的max_user_processes并不会改变,仍然是1024,这个是因为受到了下面这个文件的影响
/etc/security/limits.d/90-nproc.conf
修改/etc/security/limits.d/90-nproc.conf将
* soft nproc 1024
修改为:
* soft nproc 65535
或者
修改/etc/security/limits.conf,将
* soft nofile 10240
修改为
Oracle soft nofile 10240
方法二:这样为每一个运行bash shell的用户执行此文件,当bash shell被打开时,该文件被读取。也就是说,当用户shell执行了bash时,运行这个文件,如果这个服务器上有多个用户,最好是用方法一。
修改了/etc/bashrc,成功了,并且不用重启。
vi /etc/bashrc
添加 :
ulimit -u 65535
退出session,从新开session再次ulimit -a 发现已经变化了
[root@i-iivphroy ~]# 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) 62842
max locked memory (kbytes, -l) 64
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) 65535
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
评论
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25052
- 42023-09-25浏览数:18521
- 52020-05-11浏览数:17526