启动mongodb,连接之后提示警告
2016-06-02T18:31:22.635+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 14794 processes, 65536 files. Number of processes should be at least 32768 : 0.5 times number of files.
根据网上提示修改了多处地方
vi /etc/security/limits.conf
#2016-6-2 modified
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
# End of file
vi /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 65536
root soft nproc unlimited
修改完配置文件都重启过系统,并且重启mongodb,仍然无效
根据进程id查看mongod加载的limit参数始终没能修改成功
[root@localhost ~]# ps -ef|grep mongod
root 3140 2604 0 18:31 ? 00:00:04 /appdev/mongodb/bin/mongod --config /data/mongodb0/conf/mongodb0.conf -quiet
root 3238 3112 0 18:32 pts/0 00:00:00 /appdev/mongodb/bin/mongo 192.168.1.205:29001
root 3260 3208 0 18:39 pts/1 00:00:00 grep mongod
[root@localhost ~]#
[root@localhost ~]# cat /proc/3140/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 10485760 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 14794 14794 processes
Max open files 65536 65536 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 14794 14794 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
[root@localhost ~]#
Max processes始终都是“14794”,而不是修改之后的“65536”
这是什么原因,求解答!
modify by 2016-06-03 10:15
后来各方面排查了一下,也根据一楼的答案检查过了;发现问题不在于mongodb,而是在supervisord
我的mongodb是用supervisord来管理的,使用supervisord来启动mongodb之后,mongodb的进程始终加载不了最新修改过的max process,如果直接用mongod命令启动mongodb则可以正常加载到最新修改的max process,supervisord配置是用root用户启动mongodb的,mongod命令也是一样用的root用户启动
全选复制放进笔记supervisord配置:
[program:mongodb]
command = /appdev/mongodb/bin/mongod --config /data/mongodb0/conf/mongodb0.conf -quiet
autostart = true
autorestart = true
redirect_stderr=true
user = root
priority=9
startsecs=30
stdout_logfile=/data/log/log4supervisord/console_mongodb.log
stdout_logfile_maxbytes=50MB
environment=NLS_LANG="AMERICAN_AMERICA.UTF8",LANG="en_US.UTF-8"
[root@localhost ~]#
实在不解,为何supervisord来管理mongodb,无法加载limits
最终解决是修改supervisord(/etc/init.d/supervisord)的启动参数,加入两行:
ulimit -n65536
ulimit -u 65536
一直是supervisord无法加载系统的/etc/security/limit.conf,而由supervisord启动监控的进程的ulimit等参数是无法超过supervisord自身的,所以只能先把supervisord的上限加大,然后mongodb才能调整.
非常感谢两位楼主的回答,都很有帮助。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。