getShardMapgetShardMapcluster에 대한 다음 정보를 반환합니다.샤드 및 config 서버 복제본 세트의 이름
클러스터의 샤드와 config 서버 복제본 세트를 구성하는 노드의 호스트 이름 및 연결 문자열
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스
중요
이 명령은 M0 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand("getShardMap")
문서 출력
다음은 명령이 반환하는 출력의 예입니다.
{ map: { shard01: 'shard01/localhost:27018,localhost:27019,localhost:27020', shard02: 'shard02/localhost:27021,localhost:27022,localhost:27023', shard03: 'shard03/localhost:27024,localhost:27025,localhost:27026', config: 'configRepl/localhost:27027' }, hosts: { 'localhost:27026': 'shard03', 'localhost:27020': 'shard01', 'localhost:27021': 'shard02', 'localhost:27024': 'shard03', 'localhost:27022': 'shard02', 'localhost:27018': 'shard01', 'localhost:27025': 'shard03', 'localhost:27019': 'shard01', 'localhost:27023': 'shard02', 'localhost:27027': 'config' }, connStrings: { 'shard01/localhost:27018,localhost:27019,localhost:27020': 'shard01', 'shard02/localhost:27021,localhost:27022,localhost:27023': 'shard02', 'shard03/localhost:27024,localhost:27025,localhost:27026': 'shard03', 'configRepl/localhost:27027': 'config' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1760637565, i: 2 }), signature: { hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0), keyId: Long('0') } }, operationTime: Timestamp({ t: 1760637565, i: 2 }) }
이 명령은 다음 필드를 반환합니다.
필드 | 설명 |
|---|---|
| 클러스터의 샤드 목록, 클러스터의 config 서버, 클러스터 내 모든 노드의 호스트 이름 및 포트입니다. |
| 매핑되는 cluster 및 샤드 또는 config 서버의 노드에 대한 호스트 이름 및 포트 목록입니다. |
| 노드가 속한 샤드 또는 config 서버별로 그룹화된 노드에 대한 연결 문자열 목록입니다. |
자세히 알아보기
더 많은 샤딩 명령어는 샤딩 명령어를 참조하세요 .