MongDB 启动警告 WARNING: soft rlimits too low

# mongo

MongoDB shell version: 3.0.2

connecting to: test

Server has startup warnings:

2015-05-09T12:34:19.688-0700 I CONTROL  [initandlisten]

2015-05-09T12:34:19.688-0700 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.

>

mongodb当前限制:1024 processes, 64000 files

mongodb建议要求:processes = 0.5*files=32000(至少)

所以需要将 processes  从1024 改为 32000 或更大.

查看当前mongodb进程信息:

[[email protected] ~]# ps -ef | grep mongod

mongod   24283     1  0 12:35 ?        00:00:04 /usr/bin/mongod -f /etc/mongod.conf
root     24240 22049  0 12:45 pts/2    00:00:00 grep mongod

[[email protected] ~]# cat /proc/24283/limits

#可以看到限制:Max processes,Max open files

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        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             1024                 32000                processes
Max open files            64000                64000                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       14833                14833                signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us    

修改 Max processes 或者 files ,有几种方法:

方法一:

修改配置文件 /etc/security/limits.d/90-nproc.conf

[[email protected] ~]# vi /etc/security/limits.d/90-nproc.conf

*          soft    nproc     1024
改为:
*          soft    nproc     32000

重启 mongod 服务:

[[email protected] ~]# service mongod restart

方法二:

修改配置文件 /etc/security/limits.conf,添加配置信息:

[[email protected] ~]# vi /etc/security/limits.conf

mongod soft nofile 64000
mongod hard nofile 64000
mongod soft nproc 32000
mongod hard nproc 32000

重启 mongod 服务:

[[email protected] ~]# service mongod restart

也可以查看 limits.conf 更多配置信息和使用方法:

[[email protected] ~]# man limits.conf

查看系统限制:

[[email protected] ~]# 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) 14833
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 14833
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

mongodb推荐设置:

-f (file size): unlimited
-t (cpu time): unlimited
-v (virtual memory): unlimited
-n (open files): 64000
-m (memory size): unlimited
-u (processes/threads): 64000

直接在当前shell中设置:ulimit -n <value>

ulimit -f unlimited
ulimit -t unlimited
ulimit -v unlimited
ulimit -n 64000
ulimit -m unlimited
ulimit -u 64000

若要系统启动时在所有生效,将上面的 ulimit 添加到 /etc/profile

[[email protected] ~]# vi /etc/profile

参考: UNIX ulimit Settings

时间: 2024-10-10 13:49:04

MongDB 启动警告 WARNING: soft rlimits too low的相关文章

mongodb 启动 WARNING: soft rlimits too low, transpar

今天启动mongodb的时候,之前一直没注意,今天发现又warning,想整一整. 下面是告警 2019-09-05T12:00:55.271+0800 I CONTROL [initandlisten] 2019-09-05T12:00:55.271+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2019-09-05T12:00:55.271

[转]“WARNING: soft rlimits too low” in MongoDB with Mac OS X

转自:Programming and Technology If you get this warning when you connect to mongo shell in Mac OX X: ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 A simple way to fix this is setting the limit just before starting mo

mongodb 安装后 出现警告:** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

警告问题:当前mongodb 支持的最大文件数有256个,但是推荐至少1024个. 解决办法: 1.关闭现在打开的mongodb 终端窗口 2.重新打开终端并运行一下命令: sudo launchctl limit maxfiles 65536 65536       sudo launchctl limit maxproc 2048 2048 ulimit -n 65536 ulimit -u 2048 3.重启终端 4.键入命令:ulimit -n 测试是否设置成功

ELK 学习笔记之 elasticsearch启动时Warning解决办法

elasticsearch启动时Warning解决办法: 转载:http://www.dajiangtai.com/community/18136.do?origin=csdn-geek&dt=1214 问题一: [2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter: Java.lang.UnsupportedOperationException: seccomp unavaila

Redis 启动警告错误解决[转]

Redis 启动警告错误解决 启动错误 1.WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1'

Redis启动警告问题的解决

第一个警告 WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 意思是:TCP backlog设置值,511没有成功,因为 /proc/sys/net/core/somaxconn这个设置的是更小的128. 临时解决方法:(即下次启动还需要修改此值) echo 511 > /proc/sys

mysql编译时报的一个警告warning: type-punning to incomplete type might break strict-aliasing rules,可能是bug

cmake的时候报了一个警告: /softdb/mysql-5.5.37/storage/innobase/handler/ha_innodb.cc:11870: warning: type-punning to incomplete type might break strict-aliasing rules/softdb/mysql-5.5.37/storage/innobase/handler/ha_innodb.cc:11871: warning: type-punning to inc

tomcat日志警告WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property &#39;debug&#39; to &#39;0&#39; did not find a matching property.

日志中有警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property. 跟踪后发现是连接池的配置问题: <Context path="/n" docBase="E:/xxx/war" debug="0" reloadable="true"

redis 启动时 Warning 警告解决及说明

启动错误 1.WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to tak