es從6.5升級到6.8(單節點)


 

原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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM