相关疑难解决方法(0)

在 Ubuntu 14.04 LTS 中永久提高 nofile 限制

我似乎无法弄清楚究竟需要什么才能为所有用户永久提升最大数量的文件描述符。

/etc/security/limits.conf

root    hard    nofile    1500000
root    soft    nofile    1000000
root    hard    nproc     15000
root    soft    nproc     10000
*       hard    nofile    1500000
*       soft    nofile    1000000
*       hard    nproc     15000
*       soft    nproc     10000
Run Code Online (Sandbox Code Playgroud)

我已将以下内容放入/etc/pam.d/common-session

session required pam_limits.so
Run Code Online (Sandbox Code Playgroud)

重新启动后,登录为任何用户和发行ulimit -n导致1024

之后,我尝试要求pam_limits.so/etc/pam.d. 重新启动。登录。没有这样的运气。

如果我发出命令ulimit -n 1000000,然后检查,限制是否按预期设置。所以,我把@reboot ulimit -n 1000000crontab -e。重新启动。登录。没有运气。

我检查/etc/ssh/sshd_config并启用了 PAM。

我尝试在每次重新启动时设置限制:

/sbin/sysctl -w fs.file-max=1000000
/sbin/sysctl -p
Run Code Online (Sandbox Code Playgroud)

没运气。

我有一台有大量并发流量的服务器,需要这么高的限制,因为服务器需要很长时间才能清除文件描述符。我该怎么做才能永久提高文件描述符限制?

ssh cron pam ulimit

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

cron ×1

pam ×1

ssh ×1

ulimit ×1