【问题标题】:Error in configuration of Mongodb sharded clusterMongodb分片集群配置错误
【发布时间】:2016-02-18 16:21:52
【问题描述】:

我在配置 Mongodb 分片集群时出错。

我尝试了rs.add("127.0.0.1:27002")rs.add("loclahost:27002")rs.add("hostname:27002") 进行分片的所有可能性

但我收到错误:

{
  "ok" : 0,
  "errmsg" : "Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2",
  "code" : 103 
}

【问题讨论】:

    标签: mongodb sharding


    【解决方案1】:

    我假设您尝试连接到主节点并尝试添加辅助节点。通过键入

    来启动 Mongo 实例
    mongo localhost:30001
    

    我想这是主要的,在这个主要的 mongod shell 中。输入这个命令

    rs.status()
    

    您将了解您的主要名称。您的次要名称也将相同,只是端口号不同。

    获得名称后,只需输入rs.add("name:port_number") 即可添加。

    【讨论】:

      【解决方案2】:

      rs.add() 用于使ReplicaSet 不是Sharded cluster

      如果您要向分片集群添加分片,可以使用sh.addShard("host:port")

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-28
        • 1970-01-01
        • 2014-10-02
        • 2016-03-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多