Search code examples
mongodbsharding

About MongoDB add shard and router server need to restart?


I build a MongoDB sharding environment and want to test the performance of migration data.

  1. I insert one billion rows in a collection in Replica Set A.
  2. I added another shard setting Replica Set B.
  3. MongoDB starts to balance chunks between those shards.

After balancing is finished, I found out I can't look up some data.

Because those data have been moved to Replica Set B, only when I restart all mongo router service am I able to query them.

Is it a normal and inevitable procedure, or is there any way to reload the whole system (through mongo shell command or anything else)?

Thank you !!!


Solution

  • I found a command that it seems help to reload the router config

    db.adminCommand({"flushRouterConfig":1});
    

    2017-05-18 After testing, it works!