由于在刚搭建es集群的时候,资源不足,所以master节点和data节点是没有拆分开的。经常造成master节点的load非常高,现在由于资源充足了,所以开始对节点角色进行改造。
- 首先把节点上面的数据驱逐到别的节点上面,这个用 es-api 即可
PUT _cluster/settings { "transient" : { "cluster.routing.allocation.exclude._ip" : "172.18.1.1,172.18.1.2,172.18.1.3" } }
- 然后修改 elastisearch.yml 的配置文件
node.master: true node.data: false node.ingest: true search.remote.connect: false
- 还原对集群的设置,虽然这不影响,但是最好还是还原一下
PUT _cluster/settings { "transient" : { "cluster.routing.allocation.exclude._ip" : "" } }
在重启的过程中,遇到以下报错:
[2020-07-10T19:16:49,211][ERROR][o.e.b.Bootstrap ] [node-141.56] Exception
java.lang.IllegalStateException: Node is started with node.data=false, but has shard data: [/tol/es-data/es742-prome/nodes/0/indices/wxAOP9NpRYiJ2SXujvEUBg/4, /tol/es-da