码迷,mamicode.com
首页 > 其他好文 > 详细

Elasticsearch6.13 升级6.24 单节点停机升级

时间:2018-05-22 14:52:51      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:HERE   执行   product   multiple   false   AC   root   pre   artifact   

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 单节点停机升级

标签:HERE   执行   product   multiple   false   AC   root   pre   artifact   

原文地址:https://www.cnblogs.com/37yan/p/9071480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!