es的节点退役

集群退役单节点

基于kibana完成集群缩容,步骤如下:

1.查看集群节点情况,确认要剔除的节点。

GET /_cat/nodes?v

2.通过GET /_cat/nodes?v,查看被剔除节点占用内存情况,和保留节点的可用内存情况,保证剔除节点后,内存充足。

3.执行剔除节点,这将导致Elasticsearch将该节点上的分片分配给其余节点,重点是操作期间,保证ES集群正常可用。重新分配所有分片后,可以关闭被剔除节点。

PUT _cluster/settings
{
  "transient": {
  "cluster.routing.allocation.exclude.name": "node-2"
  }
}

确保集群服务正常GET /_cluster/health?pretty

通过GET _nodes/node-1/stats/indices查看确认节点分片数为空后停止该节点的elastic服务

4.关闭节点服务

置空剔除节点列表

PUT _cluster/settings
{
  "transient": {
  "cluster.routing.allocation.exclude.name": null
  }
}

至此,ElasticSearch集群缩容完成。

集群缩减为单机

  1. 停止节点,将分片分配到单节点上

PUT _cluster/settings
{
  "transient": {
  "cluster.routing.allocation.exclude.name": "node-2"
  }
}

  1. 将节点添加到投票配置排除列表,等待自动重新配置,最长一分钟

POST /_cluster/voting_config_exclusions?node_names=<node_names>&timeout=1m

  1. 当前的排除列表存储在集群状态,可以通过以下方式查看:

GET _cluster/state?filter_path=metadata.cluster_coordination.voting_config_exclusions

注:立即删除所有投票配置排除项,允许任何节点在将来返回投票配置

curl -X DELETE "http://localhost:9201/_cluster/voting_config_exclusions?wait_for_removal=false"

  1. 停止elastic的节点服务

  1. 等待所有具有投票配置排除项的节点从集群中删除,然后删除所有排除项,允许任何节点将来返回投票配置

DELETE _cluster/voting_config_exclusions

  1. 查看节点状态:GET /_cluster/health?pretty , GET /_cat/nodes?v

  1. 关闭节点服务 , 置空剔除节点列表

PUT _cluster/settings
{
  "transient": {
  "cluster.routing.allocation.exclude.name": null
  }
}

  1. 完成后修改存活节点的配置

cluster.name: my-application-test
network.host: 0.0.0.0
http.port: 9201
node.name: node-1
transport.port: 9401
#cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
cluster.initial_master_nodes: ["node-1"]
#discovery.seed_hosts: ["bltzukpuclz:9401", "bltzukpuclz:9402","bltzukpuclz:9403"]
discovery.seed_hosts: ["bltzukpuclz:9401"]

参考资料:http://www.dbaselife.com/doc/895/

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值