【Mongodb】 Mongodb sharding 管理之二
shard 叢集的系統資訊也是保留在config資料庫的集合裡面的。本文介紹一些Shard 的配置資訊查詢,
mongos> use config
switched to db config
查詢當前的版本
mongos> db.getCollection("version").findOne()
{ "_id" : 1, "version" : 3 }
查詢當前的配置chunkSize的大小
mongos> db.settings.find()
{ "_id" : "chunksize", "value" : 1 }
查詢整個shard叢集的成員
mongos> db.shards.find()
{ "_id" : "shard0000", "host" : "10.250.7.225:27018" }
{ "_id" : "shard0001", "host" : "10.250.7.249:27019" }
{ "_id" : "shard0002", "host" : "10.250.7.241:27020" }
查詢被水平拆分的集合:
mongos> db.collections.find()
{ "_id" : "test.yql", "lastmod" : ISODate("1970-01-16T06:45:27.212Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : true }
查詢被水平拆分的集合分成的chunk分佈
mongos> db.chunks.find()
{ "_id" : "test.yql-_id_MinKey", "lastmod" : { "t" : 2000, "i" : 1 }, "ns" : "test.yql", "min" : { "_id" : { $minKey : 1 } }, "max" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "shard" : "shard0000" }
{ "_id" : "test.yql-_id_ObjectId('4eb298b3adbd9673afee95e3')", "lastmod" : { "t" : 1000, "i" : 3 }, "ns" : "test.yql", "min" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "max" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "shard" : "shard0000" }
{ "_id" : "test.yql-_id_ObjectId('4eb2a64640643e5bb60072f7')", "lastmod" : { "t" : 3000, "i" : 1 }, "ns" : "test.yql", "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "shard" : "shard0002" }
{ "_id" : "test.yql-_id_ObjectId('4eb2a65340643e5bb600e084')", "lastmod" : { "t" : 3000, "i" : 0 }, "ns" : "test.yql", "min" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "max" : { "_id" : { $maxKey : 1 } }, "shard" : "shard0001" }
查詢當前mongodb裡面的資料庫的shard資訊:
mongos> db.databases.find()
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : true, "primary" : "shard0000" }
{ "_id" : "mongos", "partitioned" : false, "primary" : "shard0000" }
mongos集合記錄的這個叢集中的所有mongos服務,預設每隔30s鍾ping mongos伺服器一次,以便檢視其是否alive。
mongos> db.mongos.find()
{ "_id" : "rac4:27017", "ping" : ISODate("2011-11-05T05:47:50.575Z"), "up" : 145503 }
changlog 集合
記錄了sharding 叢集的後設資料,changlog 預設記錄10M的操作。
mongos> db.changelog.findOne()
{
"_id" : "rac1-2011-11-03T14:42:14-0",
"server" : "rac1",
"clientAddr" : "10.250.7.220:53899",
"time" : ISODate("2011-11-03T14:42:14.873Z"),
"what" : "split",
"ns" : "test.yql",
"details" : {
"before" : {
"min" : {
"_id" : { $minKey : 1 }
},
"max" : {
"_id" : { $maxKey : 1 }
},
"lastmod" : {
"t" : 1000,
"i" : 0
}
},
"left" : {
"min" : {
"_id" : { $minKey : 1 }
},
"max" : {
"_id" : ObjectId("4eb298b3adbd9673afee95e3")
},
"lastmod" : {
"t" : 1000,
"i" : 1
}
},
"right" : {
"min" : {
"_id" : ObjectId("4eb298b3adbd9673afee95e3")
},
"max" : {
"_id" : { $maxKey : 1 }
},
"lastmod" : {
"t" : 1000,
"i" : 2
}
}
}
}
mongos> db.changelog.find()
{ "_id" : "rac1-2011-11-03T14:42:14-0", "server" : "rac1", "clientAddr" : "10.250.7.220:53899", "time" : ISODate("2011-11-03T14:42:14.873Z"), "what" : "split", "ns" : "test.yql", "details" : { "before" : { "min" : { "_id" : { $minKey : 1 } }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 1000, "i" : 0 } }, "left" : { "min" : { "_id" : { $minKey : 1 } }, "max" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "lastmod" : { "t" : 1000, "i" : 1 } }, "right" : { "min" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 1000, "i" : 2 } } } }
{ "_id" : "rac1-2011-11-03T14:42:16-1", "server" : "rac1", "clientAddr" : "10.250.7.220:53899", "time" : ISODate("2011-11-03T14:42:16.294Z"), "what" : "split", "ns" : "test.yql", "details" : { "before" : { "min" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 1000, "i" : 2 } }, "left" : { "min" : { "_id" : ObjectId("4eb298b3adbd9673afee95e3") }, "max" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "lastmod" : { "t" : 1000, "i" : 3 } }, "right" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 1000, "i" : 4 } } } }
{ "_id" : "rac1-2011-11-03T14:42:16-2", "server" : "rac1", "clientAddr" : "10.250.7.220:53899", "time" : ISODate("2011-11-03T14:42:16.460Z"), "what" : "moveChunk.start", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "from" : "shard0000", "to" : "shard0002" } }
{ "_id" : "rac1-2011-11-03T14:42:21-3", "server" : "rac1", "clientAddr" : "10.250.7.220:53899", "time" : ISODate("2011-11-03T14:42:21.544Z"), "what" : "moveChunk.commit", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "from" : "shard0000", "to" : "shard0002" } }
{ "_id" : "rac3-2011-11-03T14:42:21-0", "server" : "rac3", "clientAddr" : "", "time" : ISODate("2011-11-03T14:42:21.513Z"), "what" : "moveChunk.to", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "step1" : 3604, "step2" : 982, "step3" : 1, "step4" : 0, "step5" : 423 } }
{ "_id" : "rac1-2011-11-03T14:42:21-4", "server" : "rac1", "clientAddr" : "10.250.7.220:53899", "time" : ISODate("2011-11-03T14:42:21.686Z"), "what" : "moveChunk.from", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "step1" : 0, "step2" : 121, "step3" : 8, "step4" : 5005, "step5" : 69, "step6" : 29 } }
{ "_id" : "rac3-2011-11-03T14:42:29-1", "server" : "rac3", "clientAddr" : "10.250.7.220:11131", "time" : ISODate("2011-11-03T14:42:29.819Z"), "what" : "split", "ns" : "test.yql", "details" : { "before" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 2000, "i" : 0 } }, "left" : { "min" : { "_id" : ObjectId("4eb2a64640643e5bb60072f7") }, "max" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "lastmod" : { "t" : 2000, "i" : 2 } }, "right" : { "min" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "max" : { "_id" : { $maxKey : 1 } }, "lastmod" : { "t" : 2000, "i" : 3 } } } }
{ "_id" : "rac3-2011-11-03T14:42:30-2", "server" : "rac3", "clientAddr" : "10.250.7.220:11131", "time" : ISODate("2011-11-03T14:42:30.103Z"), "what" : "moveChunk.start", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "max" : { "_id" : { $maxKey : 1 } }, "from" : "shard0002", "to" : "shard0001" } }
{ "_id" : "rac3-2011-11-03T14:44:15-3", "server" : "rac3", "clientAddr" : "10.250.7.220:11131", "time" : ISODate("2011-11-03T14:44:15.246Z"), "what" : "moveChunk.commit", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "max" : { "_id" : { $maxKey : 1 } }, "from" : "shard0002", "to" : "shard0001" } }
{ "_id" : "rac3-2011-11-03T14:44:15-4", "server" : "rac3", "clientAddr" : "10.250.7.220:11131", "time" : ISODate("2011-11-03T14:44:15.389Z"), "what" : "moveChunk.from", "ns" : "test.yql", "details" : { "min" : { "_id" : ObjectId("4eb2a65340643e5bb600e084") }, "max" : { "_id" : { $maxKey : 1 } }, "step1" : 0, "step2" : 204, "step3" : 100023, "step4" : 5007, "step5" : 111, "step6" : 0 } }
mongos>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-710281/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mongodb分片(sharding)搭建、應用及管理MongoDB
- MongoDB Sharding(二) -- 搭建分片叢集MongoDB
- MongoDB 入門教程系列之二:使用 Spring Boot 操作 MongoDBMongoDBSpring Boot
- MongoDB 分片管理MongoDB
- Mongodb管理命令MongoDB
- Mongodb 管理操作MongoDB
- MongoDB最簡單的入門教程之二 使用nodejs訪問MongoDBMongoDBNodeJS
- MongoDB Sharding ChunkSize大小選擇優缺點介紹MongoDB
- MongoDB Sharding Balancer介紹和設定方法舉例MongoDB
- mongodb複製集(replica sets)+分片(sharding)環境搭建MongoDB
- MongoDB 副本集管理MongoDB
- MongoDB 資料庫管理和開發:Navicat for MongoDB macMongoDB資料庫Mac
- mongodb管理工具MongoDB
- MongoDB 副本集原理及管理MongoDB
- MongoDB 6.0.3 使用者管理MongoDB
- NoSQLBooster for MongoDB Mac(MongoDB資料庫管理) 8.1.0無限試用版SQLMongoDBMac資料庫
- MongoDBMongoDB
- express框架+mongodb簡易學生管理Express框架MongoDB
- MongoDB系列--深入理解MongoDB聚合(Aggregation )MongoDB
- Mongodb NotesMongoDB
- mongoDB操作MongoDB
- mongodb 概述MongoDB
- 上手mongodbMongoDB
- Mongodb使用MongoDB
- Attacking MongoDBMongoDB
- MongoDB 使用MongoDB
- MongoDB 索引MongoDB索引
- 如何使用m工具安裝和管理MongoDBMongoDB
- mongodb複製集(replica set)搭建及管理MongoDB
- MongoDB入門系列(四):許可權管理MongoDB
- 使用mongo-express管理mongodb資料庫ExpressMongoDB資料庫
- MongoDB 使用者與許可權管理MongoDB
- 快速掌握mongoDB(三)——mongoDB的索引詳解MongoDB索引
- 【MongoDB學習筆記】MongoDB 快速入門MongoDB筆記
- SpringBoot 整合 Spring Data Mongodb 操作 MongoDB 詳解Spring BootMongoDB
- 【MongoDB學習筆記】MongoDB索引那點事MongoDB筆記索引
- MongoDB基本操作MongoDB
- mongodb索引使用MongoDB索引
- MongoDB基本APIMongoDBAPI