如何在不停机的情况下在运行时从 Elasticsearch 集群中删除节点 [英] How to remove node from elasticsearch cluster on runtime without down time

查看:19
本文介绍了如何在不停机的情况下在运行时从 Elasticsearch 集群中删除节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在集群中有 5 个节点,并且我必须在运行时删除 2 个节点.那么如何在不影响指数的情况下做到这一点呢?

Suppose I had 5 nodes in cluster and I had to remove 2 node on run-time. So how it can be done without affecting the indices?

我收到了接近 10 Gbphour 的连续数据流,而且这些数据被连续编入索引.

I had continuous stream of data coming at nearly 10 Gbphour which is getting indexed continuously.

重新平衡对此有帮助吗?提前致谢

Is rebalancing will do any help in this? Thanks in advance

推荐答案

您可以通过告诉集群将其从分配中排除来停用节点.(来自文档此处)

You can decommission a node by telling the cluster to exclude it from allocation. (From the documentation here)

curl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
  "transient" :{
      "cluster.routing.allocation.exclude._ip" : "10.0.0.1"
   }
}';echo

这将导致 Elasticsearch 将该节点上的分片分配给其余节点,而不会将集群状态更改为黄色或红色(即使您有复制 0).

This will cause Elasticsearch to allocate the shards on that node to the remaining nodes, without the state of the cluster changing to yellow or red (even if you have replication 0).

一旦所有的分片都被重新分配,你就可以关闭节点并在那里做任何你需要做的事情.完成后,包括要分配的节点,Elasticsearch 将再次重新平衡分片.

Once all the shards have been reallocated you can shutdown the node and do whatever you need to do there. Once you're done, include the node for allocation and Elasticsearch will rebalance the shards again.

这篇关于如何在不停机的情况下在运行时从 Elasticsearch 集群中删除节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆