MongDB start WARNING: softrlimitstoolow
# Mongo
MongoDB shell version: 3.0.2
Connecting to: test
Server has startup warnings:
T12: 34: 19.688-0700 I CONTROL [initandlisten]
T12: 34: 19.688-0700 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 64000 files. number of processes shocould be at least 32000: 0.5 times number of files.
>
Mongodb current limits: 1024 processes, 64000 files
Mongodb recommendation requirements: processes = 0.5 * files = 32000 (at least)
Therefore, you need to change processes from 1024 to 32000 or greater.
View information about the current mongodb process:
[Root @ localhost ~] # Ps-ef | grep mongod
mongod 24283 1 0 12:35 ? 00:00:04 /usr/bin/mongod -f /etc/mongod.confroot 24240 22049 0 12:45 pts/2 00:00:00 grep mongod
[Root @ localhost ~] # Cat/proc/24283/limits
# Restrictions: Max processes and 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
There are several ways to modify Max processes or files:
Method 1:
Modify the configuration file/etc/security/limits. d/90-nproc.conf
[Root @ localhost ~] # Vi/etc/security/limits. d/90-nproc.conf
* Soft nproc 1024 changed to: * soft nproc 32000
Restart the mongod service:
[Root @ localhost ~] # Service producer D restart
Method 2:
Modify the configuration file/etc/security/limits. conf and add the configuration information:
[Root @ localhost ~] # Vi/etc/security/limits. conf
mongod soft nofile 64000mongod hard nofile 64000mongod soft nproc 32000mongod hard nproc 32000
Restart the mongod service:
[Root @ localhost ~] # Service producer D restart
You can also view more configuration information and usage of limits. conf:
[Root @ localhost ~] # Man limits. conf
View System Restrictions:
[Root @ localhost ~] # Ulimit-
core file size (blocks, -c) 0data seg size (kbytes, -d) unlimitedscheduling priority (-e) 0file size (blocks, -f) unlimitedpending signals (-i) 14833max locked memory (kbytes, -l) 64max memory size (kbytes, -m) unlimitedopen files (-n) 1024pipe size (512 bytes, -p) 8POSIX message queues (bytes, -q) 819200real-time priority (-r) 0stack size (kbytes, -s) 10240cpu time (seconds, -t) unlimitedmax user processes (-u) 14833virtual memory (kbytes, -v) unlimitedfile locks (-x) unlimited
Recommended mongodb settings:
-f (file size): unlimited-t (cpu time): unlimited-v (virtual memory): unlimited-n (open files): 64000-m (memory size): unlimited-u (processes/threads): 64000
Set ulimit-n directly in the current shell.
ulimit -f unlimitedulimit -t unlimitedulimit -v unlimitedulimit -n 64000ulimit -m unlimitedulimit -u 64000
To take effect at system startup, add the above ulimit to/etc/profile
[Root @ localhost ~] # Vi/etc/profile