Elasticsearch6.13 升級6.24 單節點停機升級
阿新 • • 發佈:2018-05-22
yellow artifact clu cover settings all .data ont setting
Elasticsearch6.x 升級6.y 是支持滾動升級的,目前我們測試環境只有一個節點只能停機升級了
準備工作
禁用分片分配
curl -X PUT "localhost:9200/_cluster/settings" -H ‘Content-Type: application/json‘ -d‘ { "persistent": { "cluster.routing.allocation.enable": "none" } } ‘
執行同步刷新,加速碎片恢復
curl -X POST "localhost:9200/_flush/synced"
關閉老版本
supervisorctl stop elasticsearch
啟動新版本
下載安裝包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz tar -zvxf elasticsearch-6.2.4.tar.gz -C /data/app/
chown -R elasticsearch.elasticsearch elasticsearch-6.2.4
拷貝配置文件和數據目錄
cp -rf elasticsearch-6.1.3/config/ elasticsearch-6.2.4/ cp -rf elasticsearch-6.1.3/data/ elasticsearch-6.2.4/
修改配置文件中數據的目錄
vim elasticsearch-6.2.4/config/elasticsearch.yml # Path to directory where to store the data (separate multiple locations by comma): # path.data: /data/app/elasticsearch/data
啟動新版本
vim /etc/supervisor/conf.d/es-new.conf [program:elasticsearch-new] directory=/data/app/elasticsearch-6.2.4/bin/ command=su - elasticsearch -c "/data/app/elasticsearch-6.2.4/bin/elasticsearch" autostart=true startsecs=30 autorestart=true startretries=5 user=root priority=1 redirect_stderr=true stdout_logfile_maxbytes=50MB stdout_logfile_backups=10 stdout_logfile=/var/log/elasticsearch/es-new_supervisor.out stopasgroup=false killasgroup=false
supervisorctl reload supervisorctl start elasticsearch-new supervisorctl status elasticsearch STOPPED May 22 12:58 PM elasticsearch-head RUNNING pid 890, uptime 0:42:25 elasticsearch-new RUNNING pid 889, uptime 0:42:25 kibana RUNNING pid 887, uptime 0:42:25
等待集群狀態健康狀態為yellow就行了
curl -X GET "localhost:9200/_cat/health" 1526964363 12:46:03 elasticsearchbigdata yellow 1 1 1674 1674 0 0 1674 0 - 50.0% curl -X GET "localhost:9200/_cat/recovery" product_brand_100301_shop_330778_current 0 70ms existing_store done n/a n/a 192.168.101.55 elasticsearch n/a n/a 0 0 100.0% 4 0 0 100.0% 31141 0 0 100.0% shop_brand_100479_current 0 44ms existing_store done n/a n/a 192.168.101.55 elasticsearch n/a n/a 0 0 100.0% 4 0 0 100.0% 5667 0 0 100.0%
#恢復分配
curl -X PUT "localhost:9200/_cluster/settings" -H ‘Content-Type: application/json‘ -d‘ { "persistent": { "cluster.routing.allocation.enable": null } } ‘
Elasticsearch6.13 升級6.24 單節點停機升級