mongodb ** WARNING: soft rlimits too low. rlimits set to 89999 processes

Thanks for the help. I looked but didn't understand what I should do?
I see the ribbon that I probably need!
Code:
        if checkyesno mongod_limits; then
                eval `/usr/bin/limits -e -U ${mongod_user}` 2>/dev/null
 
i tried
# vi /etc/rc.conf
and аdded a line
Code:
mongod_enable="YES"
mongod_limits="NO"
but again after the restart the same message
Code:
2020-02-25T16:46:12.884+0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 89999 processes, 3770469 files. Number of processes should be at least 1.88523e+06 : 0.5 times number of files.
 
I changed
Code:
mongod_enable="YES"
mongod_limits="YES"
and restarted, but when I went into the mongo console - I see the message again.
Code:
root@mongologsX:/home/andrian # mongo
MongoDB shell version: 3.2.11
connecting to: test
Server has startup warnings: 
2020-02-25T16:59:12.456+0200 I CONTROL  [initandlisten] 
2020-02-25T16:59:12.456+0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 89999 processes, 3770469 files. Number of processes should be at least 1.88523e+06 : 0.5 times number of files.
>
 
Performed manually:
Code:
root@mongologsX:/home/andrian # /usr/bin/limits -e -U mongodb
limit cputime unlimited;
limit filesize unlimited;
limit datasize unlimited;
limit stacksize unlimited;
limit coredumpsize unlimited;
limit memoryuse unlimited;
limit memorylocked 64;
limit maxproc unlimited;
limit openfiles unlimited;
limit sbsize unlimited;
limit vmemoryuse unlimited;
limit pseudoterminals unlimited;
limit swapsize unlimited;
limit kqueues unlimited;
limit umtxp unlimited;
root@mongologsX:/home/andrian # mongo
MongoDB shell version: 3.2.11
connecting to: test
Server has startup warnings: 
2020-02-25T16:59:12.456+0200 I CONTROL  [initandlisten] 
2020-02-25T16:59:12.456+0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 89999 processes, 3770469 files. Number of processes should be at least 1.88523e+06 : 0.5 times number of files.
>
 
And

Code:
root@mongologsX:/home/andrian # /usr/bin/limits -e -U mongodb
limit cputime unlimited;
limit filesize unlimited;
limit datasize unlimited;
limit stacksize unlimited;
limit coredumpsize unlimited;
limit memoryuse unlimited;
limit memorylocked 64;
limit maxproc unlimited;
limit openfiles unlimited;
limit sbsize unlimited;
limit vmemoryuse unlimited;
limit pseudoterminals unlimited;
limit swapsize unlimited;
limit kqueues unlimited;
limit umtxp unlimited;
root@mongologsX:/home/andrian # /usr/local/etc/rc.d/mongod restart
Stopping mongod.
Waiting for PIDS: 4042.
Starting mongod.
root@mongologsX:/home/andrian # mongo
MongoDB shell version: 3.2.11
connecting to: test
Server has startup warnings: 
2020-02-25T17:06:03.840+0200 I CONTROL  [initandlisten] 
2020-02-25T17:06:03.840+0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 89999 processes, 3770469 files. Number of processes should be at least 1.88523e+06 : 0.5 times number of files.
>
 
I`ll look at it:
Code:
root@mongologsX:/home/andrian # limits -a
Resource limits (current):
  cputime              infinity secs
  filesize             infinity kB
  datasize             33554432 kB
  stacksize              524288 kB
  coredumpsize         infinity kB
  memoryuse            infinity kB
  memorylocked         infinity kB
  maxprocesses            89999
  openfiles             3770469
  sbsize               infinity bytes
  vmemoryuse           infinity kB
  pseudo-terminals     infinity
  swapuse              infinity kB
  kqueues              infinity
  umtxp                infinity
 

root@mongologsX:/home/andrian # sysctl kern.maxprocperuid
kern.maxprocperuid: 89999

root@mongologsX:/home/andrian # sysctl kern.maxprocperuid=189999
kern.maxprocperuid: 89999 -> 189999
root@mongologsX:/home/andrian # sysctl kern.maxprocperuid
root@mongologsX:/home/andrian # /usr/local/etc/rc.d/mongod restart
Stopping mongod.
Waiting for PIDS: 4093.
Starting mongod.
root@mongologsX:/home/andrian # mongo
MongoDB shell version: 3.2.11
connecting to: test
Server has startup warnings:
2020-02-25T17:24:13.800+0200 I CONTROL [initandlisten]
2020-02-25T17:24:13.800+0200 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 189999 processes, 3770469 files. Number of processes should be at least 1.88523e+06 : 0.5 times number of files.
>


Thank you!!!!
Then I'll try myself.
 
Yes, you can set it permanently in /etc/sysctl.conf. If I recall correctly the maxprocperuid is set to a certain value based on the amount of memory, but in some cases you need to adjust it manually. Do keep an eye on kern.maxfiles too.

Code:
     -n [val]        Select or set the openfiles resource limit.  The system-
                     wide limit on the maximum number of open files per
                     process can be viewed by examining the
                     kern.maxfilesperproc sysctl(8) variable.  The total
                     number of simultaneously open files in the entire system
                     is limited to the value displayed by the kern.maxfiles
                     sysctl(8) variable.
 
Add mongod_limits="YES" to rc.conf (it defaults to NO).
Replying here to help anyone who gets to this thread via search results, as I did:

In FreeBSD 12.0 and later, you can no longer set mongod_limits="YES". You have to explicitly give the flags to pass to the limits(1) command, because the SERVICENAME_limits="*" variable in /etc/rc.conf is part of the rc.subr(8) script for all services.

Two sensible settings would be:
1. The limits that already apply to the mongodb user: mongod_limits="-U mongodb". You can control these any way you like via login.conf(5).
2. The MongoDB recommended limits: mongod_limits="-n 64000 -u 64000".

Proper settings will prevent MongoDB from complaining at startup: ** WARNING: soft rlimits too low. rlimits set to XXXXXX processes, YYYYYY files. Number of processes should be at least ZZZZZZ : 0.5 times number of files. Optimal settings, of course, are site-specific.
 
Back
Top