174

I've been using mongo on my mac os x 10.8 and suddenly yesterday at my logs appeared this warning (and when starting shell it's present too) -

WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

Who could explain, what does it mean? And should I increase number of rlimits somehow?

bjb568
  • 11,089
  • 11
  • 50
  • 71
Kosmetika
  • 20,774
  • 37
  • 108
  • 172

1 Answers1

154

on mac, you probably using mongodb for development purpose. If yes, then you can ignore this.

Aniruddha
  • 3,513
  • 6
  • 27
  • 38
  • 3
    i'm ignoring it, but i'm a bit confused why it didn't appear at the start of using mongodb – Kosmetika May 18 '13 at 10:55
  • 47
    'rlimit' is related with amount of memory allocated to process. Its os thing. In this case memory allocated to mongod process. So mongodb complaining you that memory allocated is low & it might be slow. I guess thats ok on development machine. But if you reading those on production, you defiantly need to increase that limit. – Aniruddha May 18 '13 at 11:03
  • 33
    just type "ulimit -n 2048" or something higher and it won't complain – ski_squaw Oct 07 '13 at 21:04
  • 3
    "ulimit -n 2048" has no effect. – Tvaroh Nov 06 '13 at 19:45
  • 47
    It has for me. You need to call it before starting the server: ulimit -n 2048 && mongod; afterwards you should no longer see the error. – Christian Fritz Nov 18 '13 at 23:17
  • My dev mongo crashed and lost all my collections during a long intense script run last night. It had been giving me this error. I'm assuming it had to do with the crash. I'm still unsure, but I'd urge people not to ignore this warning. – Artur Sapek Dec 22 '13 at 15:00
  • 14
    In my case, I had to do `ulimit -n 2048` at the **same** terminal tab that I start mongod process. Seems like it needs to be restarted too. Doing it so at the other tabs hadn't worked. – scaryguy Mar 06 '14 at 08:55
  • I used the `ulimit -n 2048` in the same tab and it worked no warnings. It doesn't have to be 2048 it could be anything as long as its bigger than or equal to 1000 you shouldn't get the warning. – M090009 Apr 29 '14 at 11:34
  • ulimit allocation command for MacOS should be with "-f" not "-n". here is the full command: ulimit -f 2048 – Nurul Ferdous May 25 '14 at 18:15
  • `launchctl limit maxfiles 1024 1024` – Ryan Jul 01 '14 at 15:36
  • 2
    On macos `10.9.4` (developer machine) I just added `ulimit -n 2048` in my `.profile`. – Maxence Jul 30 '14 at 09:26
  • ulimit -n 2048 && mongod works for me on OSX. Thanks to C.F. – Daniel C. Deng Feb 07 '16 at 23:16
  • I am late to the topic but answer [Shell Session Limit](http://unix.stackexchange.com/a/221988) worked for me pretty well. Little too long to paste into the comment but if you ventured here you should check it out. Problem with `ulimit -n 2048` is that it doesn't persist, os you either need an alias or just follow the link for LaunchDaemons config. – FullStackForger Oct 23 '16 at 14:02
  • 1
    `launchctl limit maxfiles 1024 1024` might make your system unusable. Use larger numbers: `launchctl limit maxfiles 10000 49152`. Also, check the answer to this post, it was helful to me: https://apple.stackexchange.com/questions/366187/why-does-setting-the-hard-limit-for-maxfiles-to-unlimited-using-launchctl-lim/366319 – hernvnc Aug 19 '20 at 18:20