Elasticsearch集群的重啟操作
大概分為四步(備注我的elasticsearch版本為6.3.2 -- 版本很重要):
1.暫停ES集群分片
2.殺掉es所有節點
3.啟動所有節點
4.恢復es集群分片
1.暫時ES集群分片
curl -XPUT -H 'Content-Type:application/json' http://ip:port/_cluster/settings -d '
{
"transient" : {
"cluster.routing.allocation.enable" : "none"
}
}'
2.殺掉es所有節點
最簡單的方法是 ps -ef| grep elasticsearch
kill -9 ${pid}
最好是生成腳本,直接執行,我就不演示了
3.啟動所有節點
切換到elasticsearch的bin目錄
./elasticsearch -d
最好是生成腳本,直接執行,我就不演示了
4.恢復es集群分片
curl -XPUT -H 'Content-Type:application/json' http://ip:port/_cluster/settings -d '
{
"transient" : {
"cluster.routing.allocation.enable" : "all"
}
}'
浙公網安備 33010602011771號