修改Linux的open files參數是,立即生效,無需重啓

通過命令ulimit -a查看的open files參數的修改:

[root@nginx ~]# 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) 7697

max locked memory       (kbytes, -l) 64

max memory size         (kbytes, -m) unlimited

open files                      (-n) 65535

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) 1024

virtual memory          (kbytes, -v) unlimited

file locks                      (-x) unlimited

  1. 通過命令ulimit -n number可以直接修改,但是修改的只是當前會話的open files,重新打開一個連接查看的open files還是原來的。

  2. 修改配置文件/etc/security/limits.conf 添加

    *       soft    nofile  65535

    *       hard    nofile  65535

    注意格式,會立即生效,重新連接一下就可以看到了,ulimit -a。

不需要重啓,就會立即生效的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章