On this page本页内容
flushRouterConfig
¶flushRouterConfig
marks the cached routing table for a sharded cluster as stale, causing the next operation that requests the routing table to refresh the cache. Management of the routing table cache is generally handled automatically by the cluster. You should only need to run the flushRouterConfig
command manually in specific instances, as indicated under Considerations.
Note
Starting in MongoDB 4.4, running flushRouterConfig
is no longer required after executing the movePrimary
or dropDatabase
commands. These two commands now automatically refresh a sharded cluster’s routing table as needed when run.
Starting in MongoDB 4.0.6 (and 3.6.11), the flushRouterConfig
is available on both mongos
and mongod
instances, and has the following syntax:语法如下所示:
1
):
Note
In MongoDB 4.0.5 and earlier (and 3.6.10 and earlier), flushRouterConfig
is only available for mongos
instances and can only flush the cache for all databases and their collections:
Generally, a sharded cluster’s routing table is automatically refreshed as needed as part of normal operation. However, you should manually issue the flushRouterConfig
command in the following instances:
movePrimary
or dropDatabase
commands.jumbo
flag from a chunk that could not be split (i.e. an indivisible chunk). See Clear jumbo Flag for more information.db.collection.getShardDistribution()
command. This ensures that the command returns the most up-to-date information.