文档菜单
文档首页
/
MongoDB 手册
/ / /

不一致的索引

本页内容

  • 描述
  • 格式
  • 示例
InconsistentIndex

在两个不同的分片上存在包含不同元数据或缺失特定索引的索引。

版本7.0.

{
type: "InconsistentIndex",
description: "<string>",
details: {
namespace: "<string>",
info: <document>
}
}

InconsistentIndex 不一致文档包含以下字段

字段
类型
描述
类型
字符串

不一致文档的类型。对于此不一致类型,返回 InconsistentIndex 的值。

描述
字符串

描述在元数据中找到的不一致。

详细信息
文档

包含有关不一致在数据库和分片集群中存在位置的额外信息的文档。

详细信息.namespace
字符串

指示不一致存在的数据库和集合。

详细信息.info
文档
不一致索引的信息。

使用db.adminCommand() 方法调用 checkMetadataConsistency 命令

db.adminCommand( {
checkMetadataConsistency: 1,
checkIndexes: true
} )

此方法返回一个游标,包含显示在分片元数据中找到的不一致的文档批。下面的示例显示了包含 InconsistentIndex 不一致文档的游标

{
cursor: {
id: Long("0"),
ns: "test.$cmd.aggregate",
firstBatch: [
{
type: "InconsistentIndex",
description: "Found an index of a sharded collection that is inconsistent between different shards",
details: {
namespace: "test.authors",
info: {
missingFromShards: [
"shard-rs1"
],
inconsistentProperties: [ ],
indexName: "index1"
}
}
}
],
},
ok: 1
}

返回

隐藏的分片集合

本页内容