Elasticsearch 集群出现 yellow 的问题分析

栏目: 后端 · 发布时间: 6年前

内容简介:查看集群健康状态,发现状态为 yellow,这说明有副本分配不正常,我们再看 unassigned_shards 为 1 ,则说明有一个分配还未分配那么具体是那个索引下的分片呢?我们通过以下命令查看这个参数会让 cluster-health API 在我们的集群信息里添加一个索引清单,以及有关每个索引的细节(状态、分片数、未分配分片数等等)

查看集群健康状态,发现状态为 yellow,这说明有副本分配不正常,我们再看 unassigned_shards 为 1 ,则说明有一个分配还未分配

root@ubuntu:~# curl -X GET nes01-giio.nes.cn-east-1.internal:9200/_cluster/health?pretty
{
  "cluster_name" : "nes01",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 1,
  "active_shards" : 1,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 1,
  "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
}

那么具体是那个索引下的分片呢?我们通过以下命令查看

root@ubuntu:~# curl -X GET nes01-giio.nes.cn-east-1.internal:9200/_cluster/health?level=indices | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   579  100   579    0     0  63361      0 --:--:-- --:--:-- --:--:-- 64333
{
    "active_primary_shards": 1,
    "active_shards": 1,
    "active_shards_percent_as_number": 50.0,
    "cluster_name": "nes01",
    "delayed_unassigned_shards": 0,
    "indices": {
        ".kibana": {
            "active_primary_shards": 1,
            "active_shards": 1,
            "initializing_shards": 0,
            "number_of_replicas": 1,
            "number_of_shards": 1,
            "relocating_shards": 0,
            "status": "yellow",
            "unassigned_shards": 1
        }
    },
    "initializing_shards": 0,
    "number_of_data_nodes": 1,
    "number_of_in_flight_fetch": 0,
    "number_of_nodes": 1,
    "number_of_pending_tasks": 0,
    "relocating_shards": 0,
    "status": "yellow",
    "task_max_waiting_in_queue_millis": 0,
    "timed_out": false,
    "unassigned_shards": 1
}

这个参数会让 cluster-health API 在我们的集群信息里添加一个索引清单,以及有关每个索引的细节(状态、分片数、未分配分片数等等)

问题解决

1.该问题后来查看是因为集群所在的网络之间通信的端口 9300 不通导致的机器无法同步分配,防火墙进行设置即可。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

网站入侵与脚本攻防修炼

网站入侵与脚本攻防修炼

逍遥 / 2008-9 / 59.00元

《网站入侵与脚本攻防修炼》从“攻”、“防”两个角度,通过现实中的入侵实例,并结合原理性的分析,图文并茂地展现网站入侵与防御的全过程。全书共分8章,系统地介绍网站入侵的全部过程,以及相应的防御措施和方法。其中包括网站入侵的常见手法、流行网站脚本入侵手法揭密与防范、远程攻击入侵网站与防范、网站源代码安全分析与测试等。《网站入侵与脚本攻防修炼》尤其对网站脚本漏洞原理进行细致的分析,帮助网站管理员、安全人......一起来看看 《网站入侵与脚本攻防修炼》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

html转js在线工具
html转js在线工具

html转js在线工具