关键词:elasticsearch , es , 滚动重启 , 禁止分片

由于之前es GC没有怎么调优,结果今天被大量scroll查询查挂了,GC 卡死了。然后为了先恢复给业务使用,也没什么其他办法,只能重启server。重启的时候傻逼了,忘记了禁止分片,于是起来后集群就在重新做分片迁移了。这里记录一下ES部分重启或滚动重启的步骤。

参考:https://www.elastic.co/guide/en/elasticsearch/guide/current/_rolling_restarts.html

一般情况下可能是server因为GC、负载等原因卡死了,或升级了需要重启的配置了,这类场景下会要重启部分server或整个集群滚动重启。但是在这类重启场景下,ES的数据实际是没丢失的(指的是ES已经存下的数据,正在写入的数据需要客户端去自己做好重试)。

具体步骤就参见上面的官方文档link了:

  1. If possible, stop indexing new data. This is not always possible, but will help speed up recovery time. (补充:如果可以的话,最好停止读写后jmap触发强制GC看看有没机会让假死的程序恢复,虽然一般停止用户读写可能性不大;另,在停止服务前可以的话建议做好flush操作,但不是必须。)
  2. Disable shard allocation. This prevents Elasticsearch from rebalancing missing shards until you tell it otherwise. If you know the maintenance window will be short, this is a good idea. You can disable allocation as follows:

    PUT /_cluster/settings
    {
    "transient" : {
    "cluster.routing.allocation.enable" : "none"
    }
    }
  3. Shut down a single node.
  4. Perform a maintenance/upgrade.
  5. Restart the node, and confirm that it joins the cluster.
  6. Reenable shard allocation as follows:

    PUT /_cluster/settings
    {
    "transient" : {
    "cluster.routing.allocation.enable" : "all"
    }
    }

    Shard rebalancing may take some time. Wait until the cluster has returned to status greenbefore continuing.

  7. (repeat前建议先确认集群状态,看看有没重启后出现问题)Repeat steps 2 through 6 for the rest of your nodes.
  8. At this point you are safe to resume indexing (if you had previously stopped), but waiting until the cluster is fully balanced before resuming indexing will help to speed up the process.

Elasticsearch 滚动重启 必读的更多相关文章

  1. ElasticSearch关闭重启命令

    很多人学习elasticSearch都是自学,想百度一下如何重启es也是没有答案,我硬着头皮,算是琢磨出来了,借此写博,希望能帮助您. 1.如何关闭ES,elasticsearch关闭办法 1.使用h ...

  2. elasticsearch安全重启节点

    elasticsearch集群,有时候可能需要修改配置,增加硬盘,扩展内存等操作,需要对节点进行维护升级.但是业务不能停,如果直接kill掉节点,可能导致数据丢失.而且集群会认为该节点挂掉了,就开始转 ...

  3. linux 添加elasticsearch 开机重启(自启动)

    在 /etc/init.d 文件夹下建立脚本 eg:data.sh #chkconfig: 2345 80 90#description:auto_run#!bin/bashexport JAVA_H ...

  4. elasticsearch的重启

    没有重启的操作,只有关闭了再启动的操作. ps -ef | grep elastic e表示全部的进程,f表示展示进程间的相关关系,如父子进程. 然后找到你启动es的那个账号,不是root,一般是新建 ...

  5. elasticsearch如何安全重启

    elasticsearch如何安全重启节点 问题: elasticsearch集群,有时候可能需要修改配置,增加硬盘,扩展内存等操作,需要对节点进行维护升级.但是业务不能停,如果直接kill掉节 点, ...

  6. elasticsearch之节点重启

    Elasticsearch节点重启时背后发生的故事有哪些,应该注意哪些配置内容,本篇文章做一个简单的探讨. 节点离开 在elasticsearch集群中,假设NodeA因为种种原因退出集群,在Node ...

  7. elasticsearch 大集群,双重别名,滚动更新分词方案

    elasticsearch 滚动更新分词 国内用ik.hanlp.ansj或基于其二次开发的比较多 必然有分词变更的操作(主要是是加词) reindex+别名可以解决一部分问题,但在大集群上会影响业务 ...

  8. Elasticsearch集群运维

    一.索引管理 1. 创建索引 PUT test-2019-03 { "settings": { "index": { "number_of_shard ...

  9. Elasticsearch 监控和部署

    Elasticsearch: ! [ https://elasticsearch.cn/book/elasticsearch_definitive_guide_2.x/_cluster_health. ...

随机推荐

  1. 论文阅读笔记(七)YOLO

    You Only Look Once: Unified, Real-Time Object Detection Joseph Redmon, CVPR, 2016 1. 之前的目标检测工作将分类器用作 ...

  2. CMDB项目开发

    CMDB介绍 CMDB --Configuration Management Database 配置管理数据库, CMDB存储与管理企业IT架构中设备的各种配置信息,它与所有服务支持和服务交付流程都紧 ...

  3. # 20175333曹雅坤《Java程序设计》第五周学习总结

    教材学习内容总结 第六章要点: 1.接口:1)接口声明: interface //接口的名字 2)接口体 2.实现接口:类实现接口:一个类需要在类声明中使用关键字implements声明该类实现一个或 ...

  4. MySQL:参数wait_timeout和interactive_timeout以及空闲超时的实现【转】

    一.参数意思 这里简单解释一下两个参数,含义如下: interactive_timeout:The number of seconds the server waits for activity on ...

  5. pwnable.tw dubblesort

    (留坑,远程没打成功) int __cdecl main(int argc, const char **argv, const char **envp) { int t_num_count; // e ...

  6. string format的各类格式及用法

    数字 {0:N2} 12.36  数字 {0:N0} 13  货币 {0:c2} $12.36  货币 {0:c4} $12.3656  货币 "¥{0:N2}" ¥12.36   ...

  7. 跨域资源共享(CORS)

    同源策略 同源策略是浏览器的一个安全策略,只允许当前页面或当前域下发送请求,如果向其他域发送请求,会被浏览器拦截 同源的意思:协议.IP地址.端口三者一致,浏览器才会认为是同一个域,三者中有一个不一致 ...

  8. 出错: IOException parsing XML document from ServletContext resource [/cn.mgy.conig]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/cn.mgy.conig]

    错误的详细内容: 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanDefinitionStoreExceptio ...

  9. RPA 介绍

    一 术语表 机器人流程自动化(RPA):在数字系统中模拟和集成人类行为以优化业务流程的软件机器人.RPA自动化捕获数据.运行应用程序.触发响应并与其他系统通信以执行各种任务. RPA路线图(RPA r ...

  10. 分布式缓存技术之Redis_03分布式redis

    目录 1. Redis集群 集群作用 主从复制 集群安装配置 集群数据同步及原理 2. Redis哨兵机制 master选举 哨兵sentinel的作用 哨兵sentinel之间的相互感知 maste ...