목록 데이터베이스
데이터베이스를 나열하려면 구성 데이터베이스 에서 databases 컬렉션 을 쿼리 합니다. Connect mongosh to a mongos instance and run the following operation to get a full list of the databases in your cluster:
use config db.databases.find()
샤드 나열
현재 구성된 샤드 세트를 나열하려면 다음과 같이 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", "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", "primary" : "shard0000" }