linux – /etc/security/limits.conf软nproc限制似乎被忽略

前端之家收集整理的这篇文章主要介绍了linux – /etc/security/limits.conf软nproc限制似乎被忽略前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的MongoDB数据库在加载时遇到了问题,以下错误使日志成为垃圾邮件
[initandlisten] pthread_create Failed: errno:11 Resource temporarily unavailable
[initandlisten] can't create new thread,closing connection

我得出的结论是,我需要提高1024的“ulimit -u”或“Max processes”设置,并且在使用web前端时(不确定如何检查),用量可能超过了.

我编辑了/etc/security/limits.conf来添加最后两行(前两行已经存在):

*                soft    nofile          350000
*                hard    nofile          350000
*                soft    nproc           30000
*                hard    nproc           30000

然后我重新启动了系统(BTW我应该这样做,还是应该重启mongod服务?)

重启后,查看mongod进程的进程限制,似乎忽略了软限制:

$cat /proc/2207/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             1024                 30000                processes
Max open files            350000               350000               files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       273757               273757               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

$whoami
mongod


$ulimit -a
core file size          (blocks,-c) 0
data seg size           (kbytes,-d) unlimited
scheduling priority             (-e) 0
file size               (blocks,-f) unlimited
pending signals                 (-i) 273757
max locked memory       (kbytes,-l) 64
max memory size         (kbytes,-m) unlimited
open files                      (-n) 350000
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) 1024
virtual memory          (kbytes,-v) unlimited
file locks                      (-x) unlimited

根据/etc/security/limits.conf文件,我预计“最大处理”硬限制和软限制将在30000,但只有硬盘限制.

我究竟做错了什么?

我在AWS EC2上运行Amazon Linux.

bash-4.1$cat /etc/*-release
Amazon Linux AMI release 2012.09

解决方法

检查文件/etc/security/limits.d/90-nproc.conf,因为这可能会覆盖您的设置.去年 http://scott.cm/max-processes-1024-limits-conf/我写过这个完全相同的问题

猜你在找的Linux相关文章