【问题标题】:how to assign shards which are actual unassigned?如何分配实际未分配的分片?
【发布时间】:2016-04-20 12:48:00
【问题描述】:

问题:我已经启动了五个弹性搜索节点,但只有 66,84% 的数据在 kibana 中可用。当我使用 localhost:9200/_cluster/health?pretty=true 检查集群运行状况时,我得到了以下信息:{ "cluster_name" : "A2A", "status" : "red", "timed_out" : false, "number_of_nodes" : 5, "number_of_data_nodes" : 4, "active_primary_shards" : 612, "active_shards" : 613, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 304, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 66.8484187568157 }

而且我所有的索引都是红色的,除了 kibana 索引。

小部分:

red open logstash-2015.11.08 5 0 47256 668 50.5mb 50.5mb red open logstash-2015.11.09 5 0 46540 1205 50.4mb 50.4mb red open logstash-2015.11.06 5 0 65645 579 69.2mb 69.2mb red open logstash-2015.11.07 5 0 62733 674 66.4mb 66.4mb green open .kibana 1 1 2 0 19.7kb 9.8kb red open logstash-2015.11.11 5 0 49254 1272 53mb 53mb red open logstash-2015.11.12 5 0 50885 466 53.6mb 53.6mb red open logstash-2015.11.10 5 0 49174 1288 52.6mb 52.6mb red open logstash-2016.04.12 5 0 92508 585 104.8mb 104.8mb red open logstash-2016.04.13 5 0 95120 279 107.2mb 107.2mb

我已尝试解决 curl -XPUT 'localhost:9200/_settings' -d ' {"index.routing.allocation.disable_allocation": false}' 的问题,但它不起作用!

那么你们中有人知道如何分配我的分片吗?

当您需要其他信息时,请询问,我会尽力为您提供数据:

【问题讨论】:

    标签: elasticsearch sharding


    【解决方案1】:

    你看过这个答案吗? https://stackoverflow.com/a/23816954/1834331

    您也可以先尝试重启 elasticsearch:service elasticsearch restart。

    否则,只需尝试手动重新分配分片(因为您的索引有 5 个分片,请使用shard 标志0、1、2、..5 运行命令):

    curl -XPOST -d '{ "commands" : [ {
      "allocate" : {
           "index" : "logstash-2015.11.08", 
           "shard" : 0, 
           "node" : "SOME_NODE_HERE",
           "allow_primary":true 
         } 
      } ] }' http://localhost:9200/_cluster/reroute?pretty`
    

    您可以使用以下命令检查未分配分片的节点:curl -s localhost:9200/_cat/shards | grep UNASS

    【讨论】:

    • 非常感谢 :) 这是我寻找的答案 :)
    【解决方案2】:

    如果分片卡在未分配状态,则可以手动分配。例如:

    curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
        "commands": [{
            "allocate": {
                "index": "logstash-2015.11.07",
                "shard": 5,
                "node": "Frederick Slade",
                "allow_primary": 1
            }
        }]
    }'
    

    请参阅 Cluster Reroute 文档,包括有关使用 allow_primary 的警告。

    【讨论】:

      猜你喜欢
      • 2013-09-30
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 1970-01-01
      • 2014-10-02
      • 2018-01-09
      • 2016-07-28
      • 1970-01-01
      相关资源
      最近更新 更多