【问题标题】:Elasticsearch not allocating shards nor replicas properlyElasticsearch 没有正确分配分片或副本
【发布时间】:2016-10-04 22:51:45
【问题描述】:

我正在运行一个 2 节点的弹性搜索集群,并且我的所有索引都配置了 2 个主分片和 1 个副本。起初我以为每个节点都会存储 1 个主分片和 1 个副本,尽管事实并非如此。

 curl -XGET http://localhost:9200/_cat/shards
 .kibana                   0 p STARTED       1   3.1kb 10.151.6.98 Eleggua
 .kibana                   0 r UNASSIGNED
 logstash-sflow-2016.10.03 1 p STARTED     738 644.4kb 10.151.6.98 Eleggua
 logstash-sflow-2016.10.03 1 r UNASSIGNED
 logstash-sflow-2016.10.03 0 p STARTED     783 618.4kb 10.151.6.98 Eleggua
 logstash-sflow-2016.10.03 0 r UNASSIGNED
 logstash-ipf-2016.10.03   1 p STARTED    8480   3.9mb 10.151.6.98 Eleggua
 logstash-ipf-2016.10.03   1 r UNASSIGNED
 logstash-ipf-2016.10.03   0 p STARTED    8656   6.3mb 10.151.6.98 Eleggua
 logstash-ipf-2016.10.03   0 r UNASSIGNED
 logstash-raw-2016.10.03   1 p STARTED     254 177.9kb 10.151.6.98 Eleggua
 logstash-raw-2016.10.03   1 r UNASSIGNED
 logstash-raw-2016.10.03   0 p STARTED     274   180kb 10.151.6.98 Eleggua
 logstash-raw-2016.10.03   0 r UNASSIGNED
 logstash-pf-2016.10.03    1 p STARTED    4340   2.9mb 10.151.6.98 Eleggua
 logstash-pf-2016.10.03    1 r UNASSIGNED
 logstash-pf-2016.10.03    0 p STARTED    4234   5.7mb 10.151.6.98 Eleggua
 logstash-pf-2016.10.03    0 r UNASSIGNED

如上所示,每个分片由单个节点托管,不分配副本。

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
  "cluster_name" : "es_gts_seginfo",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 9,
  "active_shards" : 9,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 9,
  "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" : 50.0
}

我做错了什么?

【问题讨论】:

  • 您能发布您的集群设置吗?您是否在 elasticsearch 日志中看到任何内容? curl -XPOST "http://localhost:9200/_cluster/reroute?explain的输出是什么
  • 您是否尝试过这里提到的步骤:stackoverflow.com/a/23816954/689625。您是否限制了每个节点的分片数量? elastic.co/guide/en/elasticsearch/reference/current/…
  • 你能显示你的节点的网络配置吗?他们是否“看到”对方,即他们是否发现了对方?

标签: elasticsearch logstash elastic-stack


【解决方案1】:

感谢大家,我能够找出问题所在。我的一个节点运行 2.4.0,另一个运行 2.4.1。这种方式重新路由无法正常工作。

curl -XPOST -d '{ "commands" : [ {
>   "allocate" : {
>        "index" : ".kibana",
>        "shard" : 0,
>        "node" : "proc-gts-elk01",
>        "allow_primary":true
>      }
>   } ] }' http://localhost:9200/_cluster/reroute?pretty
{
  "error" : {
    "root_cause" : [ {
      "type" : "illegal_argument_exception",
      "reason" : "[allocate] allocation of [.kibana][0] on node {proc-gts-elk01}{dhLrHPqTR0y9IkU_kFS5Cw}{10.151.6.19}{10.151.6.19:9300}{max_local_storage_nodes=1, hostname=proc-gts-elk01, data=yes, master=yes} is not allowed, reason: [YES(below shard recovery limit of [2])][YES(node passes include/exclude/require filters)][YES(primary is already active)][YES(enough disk for shard on node, free: [81.4gb])][YES(shard not primary or relocation disabled)][YES(shard is not allocated to same node or host)][YES(allocation disabling is ignored)][YES(total shard limit disabled: [index: -1, cluster: -1] <= 0)][YES(node meets awareness requirements)][YES(allocation disabling is ignored)][NO(target node version [2.4.0] is older than source node version [2.4.1])]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "[allocate] allocation of [.kibana][0] on node {proc-gts-elk01}{dhLrHPqTR0y9IkU_kFS5Cw}{10.151.6.19}{10.151.6.19:9300}{max_local_storage_nodes=1, hostname=proc-gts-elk01, data=yes, master=yes} is not allowed, reason: [YES(below shard recovery limit of [2])][YES(node passes include/exclude/require filters)][YES(primary is already active)][YES(enough disk for shard on node, free: [81.4gb])][YES(shard not primary or relocation disabled)][YES(shard is not allocated to same node or host)][YES(allocation disabling is ignored)][YES(total shard limit disabled: [index: -1, cluster: -1] <= 0)][YES(node meets awareness requirements)][YES(allocation disabling is ignored)][NO(target node version [2.4.0] is older than source node version [2.4.1])]"
  },
  "status" : 400
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 2011-08-04
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 2014-04-18
    相关资源
    最近更新 更多