I am running Mongo 2.6.12 and have built up quite a number of collections. I am very close to hitting the namespace cap so I want to change the 'nsSize' parameter from the default 16M to 1GB.

I have tried a few things in my configuration (/etc/mongod.conf) but nothing seems to change the default value.

Here is my current config:


I have also tried 'nsSize=' as well as 'storage : nsSize=' but to no avail as the service wouldn't start with either syntax. When I pull up my GUI (MongoChef) I see the following unchanged value.enter image description here

Any suggestions would be most appreciated as I fear I will hit the cap very soon.

  • 1
    After more reading it appears as though you cannot change the maximum namespace size after a database has been created. I am doing some more digging and will post my solution to this issue as an answer assuming someone else doesn't beat me to it.
    – niczak
    Oct 24 '17 at 15:39
  • 2
    You are correct: MMAP's namespace size cannot be changed after a database is created. However, if you have a replica set you should be able to add a new secondary with a larger nsSize which will be used when the secondary is re-synced. Note that MongoDB 2.6 reached end of life in Oct, 2016 so you should also be planning to upgrade soon. The namespace limitation is specific to the MMAP storage engine, so if you upgrade to MongoDB 3.0 or newer and use WiredTiger this limit would not be a concern.
    – Stennie
    Oct 25 '17 at 10:07

Unfortunately the answer to this is that it cannot be done. Here is what I ended up doing:

  1. Launch new EC2 w/ a handy marketplace AMI which includes Mongo (Search for 'ami-effab6df' under community AMI's)
  2. Add 'nssize=2000' to /etc/mongod.conf (For version 2.6 it is not camel cased)
  3. Added newly created server as a replica set
  4. Once data started syncing over the .ns file on the new server was indeed 2GB so I no longer have to worry about hitting the namespace cap.

Hopefully that helps someone down the road but from what I hear they changed how this works in 3.x so I am not sure if people will have to deal with this going forward.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.