
➜ sudo sysctl -a|grep file
fs.file-max = 2037581
fs.file-nr = 2784 0 2037581
➜ ~ cat /proc/sys/fs/file-max
2037581
➜ ~ cat /proc/sys/fs/file-nr
2720 0 2037581
/etc/security/limits.conf
* hard nofile 2037581
* soft nofile 2037581
root hard nofile 2037581
root soft nofile 2037581
/etc/pam.d/su
session required pam_limits.so
/etc/pam.d/common-session
session required pam_limits.so
그런 다음 재부팅하십시오.
하지만 ulimit -n은 다시 1024를 얻었습니다.
최대값으로 -n 4096만 ulimit할 수 있습니다.
또는 오류가 발생했습니다.
ulimit: value exceeds hard limit
답변1
설정하면 root hard nofile 65535
루트 사용자 제한만 변경됩니다. 다른 사용자 제한을 변경하려면 해당 사용자 이름을 추가하세요. 예를 들어,
sharewind hard nofile 65535
또는 사용자 이름에 *를 추가하면 모든 사용자 제한이 변경됩니다. 그러나 그것은 권장되지 않습니다.
답변2
upstart init 스크립트에서 서비스가 시작되는 경우 이를 제어하려면 스탠자 제한을 사용해야 한다는 것을 알았습니다!
보다:http://bryanmarty.com/2012/02/10/setting-nofile-limit-upstart/