ulimit
是一个在 Unix 和类 Unix 系统(如 Linux)中使用的 shell 内置命令,用于控制用户进程可以使用的系统资源量。它允许用户或管理员为特定的 shell 会话设置各种限制。
ulimit -n
得到的结果是1024,这个值在生产环境中有点小,建议改大
ulimit -SHn 65535
如果退出则会失效
打开/etc/security/limits.conf
添加以下内容
root soft nofile 65535
root hard nofile 65535
root soft nproc 65535
root hard nproc 65535
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
解释:*能匹配所有用户但不包含root。root需要单独配置
重启生效
因篇幅问题不能全部显示,请点此查看更多更全内容