• elasticsearch5.0.1集群索引分片丢失的处理


    elasticdump命令安装
    yum install npm
    npm install elasticdump -g
    命令安装完毕,可以测试。
    可能会报出nodejs的版本之类的错误,你需要升级一下版本。
    npm install -g n
    n stable
    至此可以使用。

    问题描述:
    索引label的0分区的主分区和复制分区全部丢失,集群状态是红色,并且新的数据无法写入
    如下
    curl 192.168.0.11:9200/_cat/shards
    label    0 p UNASSIGNED
    label    0 r UNASSIGNED

    解决思路:
    将现有的数据备份出来,然后重新导入

    具体步骤:
    1.先备份数据和mapping:

    # 备份mapping
    elasticdump --ignore-errors=true  --scrollTime=120m  --bulk=true --input=http://192.168.0.11:9200/label   --output=label_mapping.json  --type=mapping

    # 备份数据
    elasticdump --ignore-errors=true  --scrollTime=120m  --bulk=true --input=http://192.168.0.11:9200/label   --output=label_data.json  --type=data

    2.删除现有的voice:live:logout索引
    curl -X DELETE http://192.168.0.11:9200/label

    3.再次导入刚才备份的数据
    # 导入mapping
    elasticdump --input=label_mapping.json  --output=http://192.168.0.11:9200/label --type=mapping

    # 导入数据
    elasticdump --input=label_data.json --output=http://192.168.0.11:9200/label --type=data

    可以看到集群恢复了
    $ curl 192.168.0.11:9200/_cluster/health?pretty
    {
      "cluster_name" : "chinasoft_es",
      "status" : "green",
      "timed_out" : false,
      "number_of_nodes" : 11,
      "number_of_data_nodes" : 10,
      "active_primary_shards" : 91,
      "active_shards" : 182,
      "relocating_shards" : 2,
      "initializing_shards" : 0,
      "unassigned_shards" : 0,
      "delayed_unassigned_shards" : 0,
      "number_of_pending_tasks" : 0,
      "number_of_in_flight_fetch" : 0,
      "task_max_waiting_in_queue_millis" : 0,
      "active_shards_percent_as_number" : 100.0
    }

  • 相关阅读:
    前端知识体系(一)浏览器机制以及进程线程的关系
    页面之间的通信
    DOM
    浏览器内核及浏览器对象
    js正则表达式
    setTimeout和setInterval
    原生js操作cookie
    apply、call、bind方法调用
    一个简单的hexo搭建博客网站的故事
    debug for bin runtime error
  • 原文地址:https://www.cnblogs.com/dongruiha/p/8512806.html
Copyright © 2020-2023  润新知