首页 文章

添加和删除节点后的状态黄色弹性搜索

提问于
浏览
0

我有一个elasticsearch集群,其中包含2个数据节点和一个副本节点(绿色状态) . 如果我添加新节点,状态仍为绿色 . 如果我在新添加的节点上关闭elasticsearch,我将获得黄色状态 . 我怎样才能理解为恢复到2个节点而不是3个并获得绿色状态?

关机前:

{
  "cluster_name" : "elastic_poiuytrez",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 5,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 65,
  "active_shards" : 130,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0
}

curl -XGET http://localhost:9200/_cluster/settings?pretty=true
{
  "persistent" : { },
  "transient" : { }
}

这是我关闭其中一个节点时得到的结果:

{
  "cluster_name" : "elastic_poiuytrez",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 4,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 65,
  "active_shards" : 87,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 43,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0
}

节点设置:http://pastebin.com/wpmsRAbK(弹性节点-1已关闭)

1 回答

  • 0

    从我的集群状态经验绿色/黄色/红色:

    a)取决于副本的数量:某些副本已放在新节点上,必须重新创建或移动到其余节点

    b)如果ES在内存上运行紧张,并且出于其他原因(如删除节点),则可以将一个或多个副本分配给未分配 . 群集将为黄色,直到“unassigned_shards”降至0

    看看你的帖子,请注意:

    "unassigned_shards" : 43,
    

    这将导致群集处于黄色状态 . 可能需要一些时间才能让剩余节点上的所有内容都进行混乱 .

    看着“unassigned_shards”可以向你展示“走向绿色”

相关问题