이 버전의 문서는 보관되어 더 이상 지원되지 않습니다. 5.0 배포서버 업그레이드 하려면 MongoDB 6.0 업그레이드 절차를 참조하세요.
샤딩이 활성화된 데이터베이스 나열
샤딩 databases 활성화된 데이터베이스를 나열하려면구성 데이터베이스에서 컬렉션 쿼리 . partitioned 필드 의 값이 true인 경우 데이터베이스 샤딩 활성화된 것입니다. mongosh mongos 를 인스턴스 에 연결하고 다음 작업을 실행 샤딩 활성화된 데이터베이스의 전체 목록을 가져옵니다.
use config db.databases.find( { "partitioned": true } )
예시
다음의 명령 시퀀스를 사용하여 클러스터의 모든 데이터베이스 목록을 반환할 수 있습니다.
use config db.databases.find()
다음과 같은 결과 세트가 반환되면
{ "_id" : "test", "primary" : "shardB", "partitioned" : false } { "_id" : "animals", "primary" : "shardA", "partitioned" : true } { "_id" : "farms", "primary" : "shardA", "partitioned" : false }
animals 데이터베이스에 대해서만 샤딩이 활성화됩니다.
샤드 나열
현재 구성된 샤드 세트를 나열하려면 다음과 같이 listShards 명령을 사용합니다.
db.adminCommand( { listShards : 1 } )
클러스터 상세 정보 보기
클러스터 상세 정보를 보려면 db.printShardingStatus() 또는 sh.status()를 실행합니다. 두 메서드 모두 동일한 출력을 반환합니다.
예시
다음 예시에서는 sh.status()의 출력이
sharding version샤드 메타데이터의 버전 번호를 표시합니다.shards클러스터에서 샤드로 사용되는mongod인스턴스 목록을 표시합니다.databases샤딩이 활성화되지 않은 데이터베이스를 포함하여 클러스터의 모든 데이터베이스를 표시합니다.foo데이터베이스에 대한chunks정보는 각 샤드에 존재하는 청크 개수와 각 청크의 범위를 표시합니다.
--- Sharding Status --- sharding version: { "_id" : 1, "minCompatibleVersion" : 5, "currentVersion" : 6, "clusterId" : ObjectId("59a4443c3d38cd8a0b40316d") } shards: { "_id" : "shard0000", "host" : "m0.example.net:27018" } { "_id" : "shard0001", "host" : "m3.example2.net:27018" } { "_id" : "shard0002", "host" : "m2.example.net:27018" } active mongoses: "3.4.7" : 1 autosplit: Currently enabled: yes balancer: Currently enabled: yes Currently running: no Failed balancer rounds in last 5 attempts: 0 Migration Results for the last 24 hours: 1 : Success databases: { "_id" : "foo", "partitioned" : true, "primary" : "shard0000" } foo.contacts shard key: { "zip" : 1 } unique: false balancing: true chunks: shard0001 2 shard0002 3 shard0000 2 { "zip" : { "$minKey" : 1 } } -->> { "zip" : "56000" } on : shard0001 { "t" : 2, "i" : 0 } { "zip" : 56000 } -->> { "zip" : "56800" } on : shard0002 { "t" : 3, "i" : 4 } { "zip" : 56800 } -->> { "zip" : "57088" } on : shard0002 { "t" : 4, "i" : 2 } { "zip" : 57088 } -->> { "zip" : "57500" } on : shard0002 { "t" : 4, "i" : 3 } { "zip" : 57500 } -->> { "zip" : "58140" } on : shard0001 { "t" : 4, "i" : 0 } { "zip" : 58140 } -->> { "zip" : "59000" } on : shard0000 { "t" : 4, "i" : 1 } { "zip" : 59000 } -->> { "zip" : { "$maxKey" : 1 } } on : shard0000 { "t" : 3, "i" : 3 } { "_id" : "test", "partitioned" : false, "primary" : "shard0000" }