MongoDB sh.status() 和 db.getShardDistribution() 结果与分片不一致
MongoDB sh.status() and db.getShardDistribution() results not consistent about shards
当我在 MongoDB 服务器上 运行 sh.status()
时,它显示集合已分片,有 3 个分片并在每个数据库中标识主分片。
当我运行db.getCollection('ReportRow').getShardDistribution()
时,它returns
Collection reporting.ReportRow is not sharded
,尽管 sh.status 表明它是。
关于为什么 MongoDb 会有这种差异有什么想法吗?
分片实例存在,但数据没有被分片。
检查以确保分片键作为索引存在于集合中:
- db.collection.getIndexes()
当我在 MongoDB 服务器上 运行 sh.status()
时,它显示集合已分片,有 3 个分片并在每个数据库中标识主分片。
当我运行db.getCollection('ReportRow').getShardDistribution()
时,它returns
Collection reporting.ReportRow is not sharded
,尽管 sh.status 表明它是。
关于为什么 MongoDb 会有这种差异有什么想法吗?
分片实例存在,但数据没有被分片。
检查以确保分片键作为索引存在于集合中: - db.collection.getIndexes()