定義
flushRouterConfigflushRouterConfigmarks 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 theflushRouterConfigcommand manually in specific instances, as indicated under Considerations.
注意
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.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas はクラウドでの MongoDB 配置のための完全管理サービスです
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
The flushRouterConfig is available on both mongos and mongod instances, and has the following syntax:
コレクション名前空間パラメーターで渡される場合、指定されたコレクションのキャッシュをフラッシュします。
db.adminCommand( { flushRouterConfig: "<db.collection>" } ) データベース名前空間パラメーターで渡されると、指定されたデータベースとそのコレクションすべてのキャッシュをフラッシュします。
db.adminCommand( { flushRouterConfig: "<db>" } ) パラメータなしで実行されるか、string 以外のスカラー値(例:
1):db.adminCommand("flushRouterConfig") db.adminCommand( { flushRouterConfig: 1 } )
Considerations
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 before running the db.collection.getShardDistribution() command. This ensures that the command returns the most up-to-date information.