0

I'm trying to do repairDatabase of MongoDB on Ubuntu 16.04 but it fails with an error "errno:24 Too many open files" ("code" : 16818).

I've raised "ulimit -n" up to 1024000, restarted the server, but still getting the same error. It does not seem possible to raise it higher and I'm stuck with no ideas. Please help!

Artico
  • 101
  • 6
  • How many collections do you have ? MongoDB can raise this error if you are using the WiredTiger storage engine with many collections. Are you trying to repair the primary or a secondary instance ? – Alex Aug 11 '16 at 20:08
  • I'm using MMAP storage engine and having only one instance. There are about 10 collections, but one of them is pretty big (total size of DB files is about 170GB) – Artico Aug 13 '16 at 05:35

1 Answers1

1

We have faced similar issue. First please make sure number of file descriptors used by "mongod" process while running repairDatabase() command. You can verify this with the help of "lsof -p mongod_pid" Also please note, if you want to change "max number of process", you need to edit "/etc/security/limits.conf" file by adding entry for mongod process.

Edit: Also there is already feature request to open file per database as currently "wiredtiger" opens one file per collection and one for index. Also one should seriously look into horizontal scaling by sharding if cost is not a serious issue.

user3526905
  • 171
  • 1
  • 12
  • Thank you for your answer! To be honest, the issue is quite old, and I don't even remember how did I overcome it at that time... So I cannot really check your solution now, sorry. – Artico Feb 12 '18 at 19:26
  • I thought it will be helpful for someone who may face similar issue in future. – user3526905 Feb 13 '18 at 13:12