【问题标题】:MongoDB sh.status() and db.getShardDistribution() results not consistent about shardsMongoDB sh.status() 和 db.getShardDistribution() 结果关于分片不一致
【发布时间】:2018-11-13 19:21:07
【问题描述】:

当我在我的 MongoDB 服务器上运行 sh.status() 时,它显示集合是分片的,有 3 个分片并标识每个数据库中的主分片。

当我运行db.getCollection('ReportRow').getShardDistribution() 时,它会返回 Collection reporting.ReportRow is not sharded,尽管 sh.status 显示它是。

关于为什么 MongoDb 会有这种差异的任何想法?

【问题讨论】:

  • 这个问题确实属于dba.stackexchange.com,这是用于数据库管理和配置问题的站点。 StackOverflow 仅用于编程主题,此问题不是。 请通过删除和重新发布将您的问题移至正确的网站。

标签: mongodb sharding


【解决方案1】:

分片实例存在,但数据未分片。

检查以确保分片键作为索引存在于集合中: - db.collection.getIndexes()

【讨论】:

    猜你喜欢
    • 2018-01-01
    • 1970-01-01
    • 2020-05-16
    • 2021-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-21
    • 2021-01-22
    相关资源
    最近更新 更多