Mongodb – How to shutdown mongodb sharded cluster temporary

mongodbsharding

I have setup mongodb sharded cluster with following topology

  • 3×3 shards (each have 2 replica sets)
  • 1×3 config server replica cluster
  • 2 mongos routers

I want to shutdown whole cluster temporary keeping data integrity intact.
I may use this setup later so I do not want to scrap whole setup.

Any suggestions would be appreciated.

Best Answer

  1. stop balancing - run sh.stopBalancer() from mongos

  2. shutdown mongos services - run db.shutdownServer() from mongos

  3. shutdown config mongod services - run db.shutdownServer() from config server mongod

  4. shutdown shards mongod services - run db.shutdownServer() from replica set mongod