我需要在Ubuntu 12.04上增加ulimit -n。 目前是:
open files (-n) 1024
(1024软,4096硬)
在/etc/security/limits.conf中我有:
root soft nofile 10240 root hard nofile 10240
在/etc/pam.d/login中,/etc/pam.d/common-session,/etc/pam.d/common-session-noninteractive我有
session required pam_limits.so
但是,ulimit -n不断重置为1024.我需要增加它,因为我永远使用Node.js / socket.io,并且限制了并发访问者/连接的最大值。
你如何开始你的程序?
尝试用这样的东西来包装你的程序的开始代码:
/bin/bash -c "ulimit -n 4096; exec /usr/bin/node /PATH_TO/YOUR_PROGRAM.js"
你有什么像/etc/limits.d/*? 你有没有试过closuresSELinux(如果你打开了)?
将ulimit -n 10240添加到/root/.bashrc
Debian 8中存在同样的问题,当我m running Redis via the init script it came with. Lost 16 hours writing configs & rebooting trying to get past the limit of 1020 connections running as non-root. I m running Redis via the init script it came with. Lost 16 hours writing configs & rebooting trying to get past the limit of 1020 connections running as non-root. I m running Redis via the init script it came with. Lost 16 hours writing configs & rebooting trying to get past the limit of 1020 connections running as non-root. I会以root身份运行它。 AFAIK apache服务器是这样工作的:以root身份启动,设置进程范围并将uid放到www-data。