AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

balancerCollectionStatus (데이터베이스 명령)

balancerCollectionStatus

샤드 collection의 청크가 균형을 이루고 있는지 여부에 대한 정보가 포함된 문서를 반환합니다(즉, 또는 샤드 배출, 구역 위반 또는 샤드 간 청크의 불균형으로 인해 이동해야 하는 경우).

You can only issue the balancerCollectionStatus against the admin database.

팁

In mongosh, this command can also be run through the sh.balancerCollectionStatus() helper method.

Helper methods are convenient for mongosh users, 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

명령은 다음과 같은 구문을 가집니다:

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)
}
}
}
필드
설명

"chunkSize"

버전 5.3에 추가 되었습니다.

청크 크기를 메가바이트 단위로 나타내는 정수입니다.

"balancerCompliant"

청크를 이동할 필요가 없는지(true) 또는 이동해야 하는지(false)를 나타내는 부울입니다.

"firstComplianceViolation"

이 네임스페이스의 청크를 이동해야 하는 이유를 나타내는 문자열입니다. 이 필드는 "balancerCompliant" 가 false 인 경우에만 사용할 수 있습니다.

가능한 값은 다음과 같습니다.

"chunksImbalance"
collection에 대해 청크가 가장 많은 샤드와 청크가 가장 적은 샤드 간의 청크 수 차이가 마이그레이션 임계값을 초과합니다.
"defragmentingChunks"
쿼리된 네임스페이스는 현재 청크 조각 모음 프로세스를 진행 중입니다. 조각 모음은 configureCollectionBalancing 명령으로 트리거할 수 있습니다.
"draining"
샤드 제거 작업 이 진행 중이며 MongoDB 는 제거된 샤드 에서 청크를 다른 샤드로 배출해야 합니다.
"zoneViolation"
청크가 샤드에 대해 정의된 구역 범위 를 위반합니다.

이 필드는 MongoDB에서 관찰된 첫 번째 위반에 대한 정보만 반환합니다. firstComplianceViolation 에서 보고된 것과 다른 이유로 인해 보류 중인 추가 청크 마이그레이션이 있을 수 있습니다.

"details"

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.

이 필드는 firstComplianceViolation 이 defragmentingChunks 인 경우에만 반환됩니다.

이 명령은 명령별 반환 필드 외에도 작업에 대한 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 필드는 현재 단계에만 적용됩니다.

더욱 자세히 알아봅니다: