zoukankan      html  css  js  c++  java
  • Elasticsearch6.13 升级6.24 单节点停机升级

    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
      }
    }
    '
  • 相关阅读:
    李白—烂尾楼题记
    [原创]网络图片延迟加载实现,超越jquery2010年3月26日
    利用反射,泛型,扩展方法快速获取表单值到实体类
    断点续传 到底是很么
    认识LINQ
    Gridview控件用法大总结
    网站性能优化总结。
    JQ小技巧
    自己写的jq_3个小插件
    MOSS中SPuser类的使用
  • 原文地址:https://www.cnblogs.com/37yan/p/9071480.html
Copyright © 2011-2022 走看看