정의
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>" } ) 매개 변수 없이 실행되거나 문자열이 아닌 스칼라 값(예:
1):db.adminCommand("flushRouterConfig") db.adminCommand( { flushRouterConfig: 1 } )
고려 사항
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.