Mongodb – Removing Database from sharded cluster in Mongo DB

mongodbsharding

I Have a mongo shard db system with two shards and and three mongos servers.My application creates DB on daily basis as per our business requirements. We have some sharded collection in each day DB.

I removed some old DB using db.dropDatabse(). Now when i connect to mongos server and run show dbs these databases are not there but when i check config database it still has entries for these database in in different collections. Like database,changelog,chunk

Could you please tell me how i can permanently delete these database

Best Answer

Unfortunately there is some stuff that will not be cleaned up through dropDatabase. On the other hand if you delete it by hand may not will be harmful. Some data like statistics will reside on your nodes anyway till the restart of mongods. (Try it out first! Not on the production), as the configuration database is relatively small and does not have huge requirements in terms of performance, that maybe even not a problem, just to be on the safe side and leave them as they are.

Also something to check out how to make the manual actions: https://stackoverflow.com/questions/9407838/mongodb-dropdatabase-not-working

and as it is mentioned on this question the dropDatabase in such case a bit bugy:https://jira.mongodb.org/browse/SERVER-4804