【问题标题】:ElasticSearch Unassigned ShardElasticSearch 未分配分片
【发布时间】:2015-05-28 12:35:52
【问题描述】:

我在具有 8 个 CPU 和 16 GB RAM 的弹性搜索集群中有 2 个节点。我已将 ES_HEAP_SIZE 设置为 10 GB。

在我设置的两台机器上的 yml 配置文件中

index.number_of_shards: 5
index.number_of_replicas: 1

并且两台机器都被允许作为主/数据 true。现在问题是我的节点 1 的第 0 个分片在重新启动后未分配。我试过了

for shard in $(curl -XGET http://localhost:9201/_cat/shards | grep UNASSIGNED | awk '{print $2}'); do
    echo "processing $shard"
    curl -XPOST 'localhost:9201/_cluster/reroute' -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "inxn", 
                  "shard" : '$shard', 
                  "node" : "node1", 
                  "allow_primary" : true
              }
            }
        ]
    }'
done

它没有给出任何错误,并表示确认为 true,并显示要初始化的分片状态,但是当我查看分片时,它仍然未初始化。

我在设置上做错了吗?我是否应该将两个节点都设为主/数据 true 并在两台机器上设置 shard:5 和 replica:1

任何帮助或建议将不胜感激。

谢谢

【问题讨论】:

  • 我注意到您正在使用端口 9201,您确定您的机器上运行了一个节点吗?检查 GET /_cat/nodes 以查看节点数量。
  • 您好,我在 node1 上使用端口 9201,因为在 9200 上有两个节点正在使用相同的索引和具有系统生成名称的数据运行。我提供了集群名称和节点名称,但我无法找到 9200 如何在 9200 上运行两个 * Jack Frost 和 m Alfie O'Meggan 节点。所以在我的集群 node1 中,我提供了 9201 端口。
  • 请检查您的yml 文件配置...是否已禁用多播。如果可能,请提供 yml 配置
  • 如果你启用了多播,那么它会自动绑定加入到在网络中运行的同一个集群

标签: elasticsearch


【解决方案1】:

我做了一个技巧来解决这个问题,我在 node1 上的索引下重命名了 0 文件夹,并在 node1 上强制完全分配第 0 个分片,它对我有用。

curl -XPOST 'localhost:9201/_cluster/reroute' -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "inxc", 
                  "shard" : 0, 
                  "node" : "node1", 
                  "allow_primary" : true
              }
            }
        ]
    }'

【讨论】:

    猜你喜欢
    • 2014-10-02
    • 2011-08-04
    • 2016-07-28
    • 1970-01-01
    • 2014-07-02
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多