原es版本:6.5.0
新es版本:6.8.5
1.禁用集群分片配置
首先查看集群分片配置
[root@localhost soft]# curl -u elastic:elastic -XGET "http://192.168.1.135:19200/_cluster/settings?pretty"
{
"persistent" : { },
"transient" : { }
}
我这里是单节点的es,所以不需要进行该操作
curl -u elastic:elastic -H 'Content-Type: application/json' -X PUT "http://192.168.1.135:19200/_cluster/settings" -d'
{
"persistent": {
"cluster.routing.allocation.enable": "primaries"
}
}
'
2.停止不必要的索引并执行同步刷新(可选操作)
[root@localhost soft]# curl -u elastic:elastic -X POST http://192.168.1.135:19200/_flush/synced?pretty
{
"_shards" : {
"total" : 42,
"successful" : 42,
"failed" : 0
},
"inoculate_new" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"db_customer" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"db_test" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
".security-6" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"reservation_new" : {
"total" : 10,
"successful" : 10,
"failed" : 0
}
}
3.停止所有正在运行的机器学习作业(6.5版本没有set_upgrade_mode,该步骤省略掉)
curl -u elastic:elastic -X POST http://192.168.1.135:19200/_ml/set_upgrade_mode?enabled=true
4.停掉原来的节点
systemctl stop elasticsearch
或是采用kill的方式杀掉es进程
5.升级指定的节点
加压安装
[root@localhost soft]# tar -xvf elasticsearch-6.8.5.tar.gz
[root@localhost soft]# mv elasticsearch-6.8.5 /home/yeemiao/
拷贝就的环境的配置文件到新的环境的相应目录下
cp /home/yeemiao/single_elasticsearch/config/{elasticsearch.yml,jvm.options} /home/yeemiao/elasticsearch-6.8.5/config/
修改es目录权限
[root@localhost yeemiao]# cd /home/yeemiao
[root@localhost yeemiao]# chown -R yeemiao.yeemiao ./elasticsearch-6.8.5/
启动
[root@localhost yeemiao]# su - yeemiao
[yeemiao@localhost bin]$ cd /home/yeemiao/elasticsearch-6.8.5/bin
[yeemiao@localhost bin]$ ./elasticsearch -d
这里很多地方报错,是因为我这里6.5的xpath是破解的,注释掉相应的配置文件即可
##xpack.security.transport.ssl.verification_mode: certificate
##xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
##xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
迁移数据文件(不是必须的)
停掉es
[yeemiao@localhost config]$ kill -9 3358
拷贝数据文件
[yeemiao@localhost single_elasticsearch]$ cp -R ./data /home/yeemiao/elasticsearch-6.8.5/
修改新升级后版本的配置文件
path.data: /home/yeemiao/elasticsearch-6.8.5/data
path.logs: /home/yeemiao/elasticsearch-6.8.5/logs
8.启用分片
curl -u elastic:elastic -H 'Content-Type: application/json' -X PUT "http://192.168.1.135:19200/_cluster/settings" -d'
{
"persistent": {
"cluster.routing.allocation.enable": null
}
}
'
9.重启机器学习作业(这个是6.8才有的功能).
curl -u elastic:elastic -X POST http://192.168.1.135:19200/_ml/set_upgrade_mode?enabled=false
10.查看健康情况
curl -u elastic:elastic -XGET http://192.168.1.135:19200/_cat/health?v
curl -u elastic:elastic 'http://192.168.1.135:19200/_cat/indices?v'
curl -u elastic:elastic http://192.168.1.135:19200/?pretty