美文网首页
IT匠心说 -《Linux系统限制》

IT匠心说 -《Linux系统限制》

作者: IT匠心说 | 来源:发表于2021-03-24 11:34 被阅读0次
  • 列出所有限制:

ulimit -a

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 62130
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1048576
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1048576
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
  • 仅列出「文件句柄数」、「最大进程数」的限制:

ulimit -n -u

open files                      (-n) 1048576
max user processes              (-u) 1048576

调整限制

  • 系统级 /etc/sysctl.conf :
fs.file-max=1048576
  • 用户级 /etc/security/limits.conf :
* soft nofile 1048576
* soft nproc 1048576

*:所有用户。
soft: 警告值。
nofile:文件句柄数。
nproc:最大进程数。

  • 重启生效

reboot

相关文章

网友评论

      本文标题:IT匠心说 -《Linux系统限制》

      本文链接:https://www.haomeiwen.com/subject/kcbchltx.html