elasticsearch将节点添加到群集

ykejflvf  于 2021-06-13  发布在  ElasticSearch
关注(0)|答案(1)|浏览(476)

我有3个节点的elasticsearch集群

192.168.2.11 - node-01
192.168.2.12 - node-02
192.168.2.13 - node-03

我用这个命令从集群中删除了node-02

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

好的,我所有的索引都移到了node-01和node-03,但是如何将这个节点返回集群呢?我试试这个命令

curl -XPUT 192.168.2.12:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
  "transient" :{
      "cluster.routing.allocation.include._ip" : "192.168.2.12"
   }
}'

但这行不通 :"node does not cluster setting [cluster.routing.allocation.include] filters [_ip:\"192.168.2.12\"]

mqxuamgl

mqxuamgl1#

该节点尚未删除,但您可以通过更新更改为的设置来“撤消”命令 null 尝试使用更新正在运行的节点(01或03)上的设置

"transient" :{
  "cluster.routing.allocation.exclude._ip" : null
}

集群应该在三个节点之间重新平衡碎片。使用时要小心 include._ip: "192.168.2.12" 因为这可能会停止将索引路由到其他两个,所以如果您想这样做,可以将所有三个ip地址都包括在内

"transient" :{
  "cluster.routing.allocation.include._ip" :"192.168.2.11, 192.168.2.12, 192.168.2.13"
}

相关问题