Mongo集群中有一个节点报坏块,然后实例直接挂掉,日志中显示部分数据文件读取错误,考虑重建数据文件对应的索引
下面的脚本可以遍历库中所有的集合及索引,并打印索引的文件名称
db.getCollectionNames().forEach(function(collName) {
var stats = db.getCollection(collName).aggregate([
{ $collStats: { storageStats: {} } }
]).next();
print("集合: " + collName);
printjson(stats.storageStats.indexDetails);
});
打印信息如下



被折叠的 条评论
为什么被折叠?



