安全的移除Es数据节点步骤 您所在的位置:网站首页 奔腾ebs节点丢失 安全的移除Es数据节点步骤

安全的移除Es数据节点步骤

2023-12-22 20:00| 来源: 网络整理| 查看: 265

说明:想要安全的移除一个es节点,不改变分片的数量,100%不会引起数据丢失,即保证这个节点的所有数据被其他节点接收。然后停止这个节点的实例。

两个节点禁用策略:

curl -XPUT http://0.0.0.0:9200/_cluster/settings?pretty -d '{"transient":{"cluster.routing.allocation.exclude._ip":"10.10.10.11,10.10.10.12"}}'

Data-node节点下线过程:

步骤1:将节点从集群路由策略中排除curl -XPUT http://0.0.0.0:9200/_cluster/settings?pretty -d '{"transient":{"cluster.routing.allocation.exclude._ip":"10.10.10.11"}}' PUT _cluster/settings { "transient": { "cluster.routing.allocation.exclude._ip": "10.1.22.129" } } 执行结果: { "acknowledged" : true, "persistent" : { }, "transient" : { "cluster" : { "routing" : { "allocation" : { "exclude" : { "_ip" : "10.1.22.129" } } } } } }步骤2:等待节点上分片全部被迁移curl http://0.0.0.0:9200/_cluster/health?pretty curl http://0.0.0.0:9200/_cluster/pending_tasks?pretty curl http://0.0.0.0:9200/_cluster/allocation/explain?pretty 1.检查集群状态 http://10.1.34.146:9200/_cluster/health?pretty { cluster_name: "my-es6-test", status: "green", timed_out: false, number_of_nodes: 4, number_of_data_nodes: 4, active_primary_shards: 150, active_shards: 272, relocating_shards: 0, initializing_shards: 0, unassigned_shards: 0, 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: 100 } 2.若出现pening_tasks,当pending_tasks的等级>=HIGH时,存在集群无法新建索引的风险 http://10.1.34.146:9200/_cluster/pending_tasks?pretty { "tasks": [] } 3.若集群中出现UNASSIGNED shards,检查原因,查看是否是分配策略导致无法迁移分片 http://10.1.22.129:9200/_cluster/allocation/explain?pretty 4.查看节点数据是否已迁移,都是 0 表示数据也已经迁移 http://10.1.34.146:9200/_nodes/%7Bnode-6%7D/stats/indices?pretty { _nodes: { total: 0, successful: 0, failed: 0 }, cluster_name: "my-es6-test", nodes: { } }步骤3:下线节点[localhost~]$ ps aux | grep Elasticsearch [localhost~]$ ps -ef | grep Elasticsearch kill -9 {pid}步骤4:取消节点禁用策略curl -XPUT http://0.0.0.0:9200/_cluster/settings?pretty -d '{"transient":{"cluster.routing.allocation.exclude._ip": null}}' PUT _cluster/settings { "transient": { "cluster.routing.allocation.exclude._ip": null } }


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有