Mongodb: too many namespaces raise on setProfiling I have a mongodb database with a single (relatively big, around 130GB) collection, with 3 indexes, on which I'd like to do some profiling.
However when I run the db.setProfilinStatus(1, 1000) command, mongodb returns the following error:

{
    "was" : 0,
    "slowms" : 100,
    "errmsg" : "exception: too many namespaces/collections",
    "code" : 10081,
    "ok" : 0
}


I have verified the nssize setting (I have nssize = 2047 in mongod.conf and I have checked the result of db.adminCommand( "getCmdLineOpts" )

Any idea what the issue might be here, and how I could enable profiling?
Thanks!
You might have missed this little bit of the nsSize docs (highlighting mine):


  Use this setting to control size for newly created namespace files.
  This option has no impact on existing files


So, you can't just change the parameter and increase the number of collections for an existing database - that will still be at the old value.  The setting actually alters the size of the &lt;dbname&gt;.ns file when it is created - if that is already in existence (for an existing database), then it stays at its original size (default 16MiB) until you cause it to be recreated.

If you are running a replica set, then the best way to cause that recreation to happen is to shutdown a secondary, make sure it will restart with the new nsSize parameter, and then wipe its data files and allow it to sync from scratch.  Since that will include creating a new .ns file it will pick up the setting and create the larger one.  Then repeat for all secondaries before finally stepping down the primary and doing it there.  Once complete you will have the setting on all nodes.

If you don't have a replica set, then I think your only options are either:


Running a repair, which will mean down time and you will need 2x your data size free at least, probably more since you are now creating 2GiB namespace files that were previously 16MB
Copying all the data to a newly created database to take advantage of the new namespace sizing


Neither of those options are going to be particularly quick, so hopefully this is a replica set and not a standalone instance. 

You could also look to clean up some of the collections in that database to give yourself some head room and time to sort it out.  Are you actually using all 24000 collections, can some be pruned?