1、调整带宽
2、禁用分片分配
curl -X PUT localhost:9200/_cluster/settings?pretty -H 'Content-Type: application/json' -d'{"persistent" : {"cluster.routing.allocation.enable": "none"}}'
3、停止非必要的索引并执行同步刷新,确保所有文档都被持久化到磁盘上,以防止数据丢失
curl -X POST "http://localhost:9200/_flush/synced?pretty"
4、关闭节点es服务,进行配置变更
-
停止es服务
service elasticsearch stop
-
停止es开机自启动(防止升级配置后重启直接加入集群)
systemctl disable elasticsearch
-
升级配置
-
重新启动
-
检查确定磁盘等信息是否正确
-
修改jvm堆内存配置
-Xms32g -Xmx32g
-
开启es 开机自启动
systemctl enable elasticsearch
-
启动es,加入集群
service elasticsearch start
-
开启es集群分片分配,并限制迁移速度
curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'{"persistent" : {"indices.recovery.max_bytes_per_sec" : "80mb"}}' curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'{"persistent" : {"cluster.routing.allocation.enable": null}}'
-
观察集群状态
5、重复上诉操作。