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

shardingState(데이터베이스 명령)

shardingState

shardingState is an admin command that reports if mongod is a member of a sharded cluster. To run the command, you must run against the admin database. See db.adminCommand().

이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스

참고

이 명령은 모든 MongoDB Atlas 클러스터에서 지원됩니다. 모든 명령에 대한 Atlas 지원에 관해 자세히 알아보려면 지원되지 않는 명령을 참조하세요.

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

db.adminCommand(
{
shardingState: 1
}
)

For shardingState to detect that a mongod is a member of a sharded cluster, the mongod must satisfy the following conditions:

  1. mongod 는 복제본 세트의 프라이머리 멤버이고,

  2. mongod 인스턴스가 샤드 cluster의 멤버입니다.

If shardingState detects that a mongod is a member of a sharded cluster, shardingState returns a document that resembles the following prototype:

{
"enabled" : true,
"configServer" : "<configdb-string>",
"shardName" : "<string>",
"shardHost" : "string:",
"versions" : {
"<database>.<collection>" : {
"placementVersion": Timestamp({ t: 1, i: 1024 }),
"timestamp": Timestamp({ t: 1682444810, i: 8 })
},
"<database>.<collection>" : {
"placementVersion": Timestamp({ t: 0, i: 0 }),
"timestamp": Timestamp({ t: 0, i: 0 })
}
},
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp({ t: 1682457265, i: 1 }),
"signature" : {
"hash" : BinData(0,"B2ViX7XLzFLS5Fl9XEuFXbwKIM4="),
"keyId" : Long("6488045157173166092")
}
},
"operationTime" : Timestamp({ t: 1682457260, i: 1 })
}

Otherwise, shardingState will return the following document:

{
"enabled" : false,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp({t:1510716515, i: 1}),
"signature" : {
"hash" : BinData(0,"B2ViX7XLzFLS5Fl9XEuFXbwKIM4="),
"keyId" : Long("6488045157173166092")
}
},
"operationTime" : Timestamp({t: 1510716515, i: 1})
}

The response from shardingState when used with a config server is:

{
"enabled" : false,
"ok" : 1,
"operationTime" : Timestamp({t: 1510767613, i: 1}),
"$gleStats" : {
"lastOpTime" : Timestamp({t: 0, i: 0}),
"electionId" : ObjectId("7fffffff0000000000000001")
},
"$clusterTime" : {
"clusterTime" : Timestamp({t: 1510767613, i: 1}),
"signature" : {
"hash" : BinData(0,"IwBZ4SZjIMI5NdM62NObV/R31GM="),
"keyId" : Long("6488693018630029321")
}
}
}

참고

mongos instances do not provide the shardingState.

경고

이 명령은 영향을 받는 데이터베이스에 대한 쓰기 잠금(write lock)을 획득하고 완료될 때까지 다른 작업을 차단합니다. 그러나 이 작업은 일반적으로 수명이 짧습니다.

이 페이지 평가하기

이 페이지의 내용