정의
balancerCollectionStatus샤드 collection의 청크가 균형을 이루고 있는지 여부에 대한 정보가 포함된 문서를 반환합니다(즉, 또는 샤드 배출, 구역 위반 또는 샤드 간 청크의 불균형으로 인해 이동해야 하는 경우).
You can only issue the
balancerCollectionStatusagainst theadmindatabase.팁
In
mongosh, this command can also be run through thesh.balancerCollectionStatus()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.adminCommand( { balancerCollectionStatus: "<db>.<collection>" } )
샤드 collection의 전체 네임스페이스("<db>.<collection>")를 지정합니다.
mongosh provides a wrapper method sh.balancerCollectionStatus().
액세스 제어
액세스 제어와 함께 실행하는 경우 명령을 실행하려면 사용자에게 데이터베이스 및/또는 enableSharding collection 에 대한 권한 조치가 있어야 합니다. 즉, 사용자에게는 다음 권한 을 부여하는 역할 이 있어야 합니다.
{ resource: { db: <database>, collection: <collection> }, actions: [ "enableSharding" ] }
기본 제공 clusterManager 역할은 적절한 권한을 제공합니다.
문서 출력
다음은 명령이 반환하는 문서의 예입니다.
{ "chunkSize": Long("128"), "balancerCompliant" : false, "firstComplianceViolation" : "chunksImbalance", "ok" : 1, "operationTime" : Timestamp(1583192967, 16), "$clusterTime" : { "clusterTime" : Timestamp(1583192967, 16), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : Long(0) } } }
필드 | 설명 |
|---|---|
| 버전 5.3에 추가 되었습니다. 청크 크기를 메가바이트 단위로 나타내는 정수입니다. |
| 청크를 이동할 필요가 없는지( |
| 이 네임스페이스의 청크를 이동해야 하는 이유를 나타내는 문자열입니다. 이 필드는 가능한 값은 다음과 같습니다.
이 필드는 MongoDB에서 관찰된 첫 번째 위반에 대한 정보만 반환합니다. |
| An object containing information on the ongoing defragmentation process. This object indicates the current phase of the defragmentation and how many chunks are left to process in that phase. For example output, see Ongoing Defragmentation Process. 이 필드는 |
이 명령은 명령별 반환 필드 외에도 작업에 대한 ok 상태 필드, operationTime 필드 및 $clusterTime 필드도 반환합니다. 이러한 필드에 대한 자세한 내용은 응답을 참조하세요.
예시
샤드 collection test.contacts 의 청크가 현재 균형을 이루고 있는지 확인하려면 mongos 인스턴스에 연결하고 다음 명령을 실행합니다.
db.adminCommand( { balancerCollectionStatus: "test.contacts" } )
collection의 청크를 이동할 필요가 없는 경우 명령은 다음과 유사한 출력을 반환합니다.
{ "chunkSize": Long("128"), "balancerCompliant" : true, "ok" : 1, "operationTime" : Timestamp(1583193238, 1), "$clusterTime" : { "clusterTime" : Timestamp(1583193238, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : Long(0) } } }
지속적인 조각 모음 프로세스
쿼리된 네임스페이스가 청크 조각 모음을 거치는 경우 balancerCollectionStatus 명령은 다음과 유사한 출력을 반환합니다.
{ "chunkSize": Long("128"), "balancerCompliant": false, "firstComplianceViolation": "defragmentingChunks", "details": { "currentPhase": "moveAndMergeChunks", "progress": { "remainingChunksToProcess": 1 } } }
참고
청크 조각 모음은 여러 단계로 진행됩니다. progress 필드는 현재 단계에만 적용됩니다.
더욱 자세히 알아봅니다:
조각 모음 모니터링 은 샤드 collection의 조각 모음 모니터링을 참조하세요.
샤드 collection 조각 모음은 샤드 collection 조각 모음을 참조하세요 .