Mongodb – Not able to access a database on shard mongodb cluster

mongodbmongodb-3.2sharding

We have a mongoDB cluster with 2 shards, 3 config servers and 5 mongos instances.
We create new database for each day and drop database(s) that are older than 10 days.

On any one mongos, when I list all databases, there is one database shown that is occupying 40 GB space. This database should have been removed by timely scripts, but that did not happen.

When I try to drop this database, error Occurs as – "database does not exist".
Find below console output of step carried out –

    mongos> show dbs
    dailyDB_A23    37.890GB
    mongos> use dailyDB_A23
    switched to db dailyDB_A23
    mongos> show collections
    mongos> db.dropDatabase()
    { "info" : "database does not exist", "ok" : 1 }
    mongos>

On using this database and listing all collections, there is nothing shown on console.
Plus when I tried taking a dump of this database, nothing is backed up and command exits withing 2 to 3 seconds.

On connecting to PRIMARY of each replica set in shard, this database is visible (ran 'show dbs' after connecting to mongo shell) and files are also present in to data directory.

Kindly help me out here. If this database does not exist (as per error on dropping) why it is showing it in list with size of ~ 40 GB?

Thanks and Regards,

Vibhav

Best Answer

Try db.repairDatabase() which fixes inconsistency across database. Check mongod and mongos logs for results.