1. 查看当前状态
1.1 查看配置信息
mongos> use config
// 查看分片
mongos> db.shards.find()
{ "_id" : "study", "host" : "study/localhost:27018,localhost:27019,localhost:27020", "state" : 1 }
// 查看分片集合信息
mongos> db.collections.find().pretty()
{
"_id" : "config.system.sessions",
"lastmodEpoch" : ObjectId("62db964a7decd7b3c3f36bc1"),
"lastmod" : ISODate("1970-02-19T17:02:47.296Z"),
"dropped" : false,
"key" : {
"_id" : 1
},
"unique" : false,
"uuid" : UUID("5351f3f9-63e3-44b8-af9a-a0261e681bef")
}
// 查询集合中块信息
mongos> db.chunks.find().pretty()
{
"_id" : "config.system.sessions-_id_MinKey",
"ns" : "config.system.sessions",
"min" : {
"_id" : { "$minKey" : 1 }
},
"max" : {
"_id" : { "$maxKey" : 1 }
},
"shard" : "study",
"lastmod" : Timestamp(1, 0),
"lastmodEpoch" : ObjectId("62db964a7decd7b3c3f36bc1"),
"history" : [
{
"validAfter" : Timestamp(1658558026, 4),
"shard" : "study"
}
]
}
// 跟踪集群拆分和迁移情况
mongos> db.changelog.find({'what': 'split'}).pretty()
————————————————
版权声明:本文为CSDN博主「沈健_算法小生」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/SJshenjian/article/details/127374192