Well,不要刷屏了

Elasticsearch关于unassigned shards修复

Elasticsearcharterforyou 发表了文章 • 2 个评论 • 6350 次浏览 • 2017-12-23 12:23 • 来自相关话题

ES 版本: 5.2.1


步骤:

  • curl localhost:9200/_cat/shards > shards
  • 跑脚本:nohup python recovery.py &

    注意:跑脚本过程会返回大量json,时间较长,请注意放入后台

  • 查看修复shard进度:curl 127.0.0.1:9200/_cat/recovery/你修复shard对应的索引
  • 结果: 找到索引对应的shard,看到existing_store done说明已经从本地修复
    shell<br /> index 19 268ms existing_store done n/a n/a 10.0.58.67 node_name<br />

    ```python

    !/usr/bin/env python

    name: recovery.py


    import requests
    import json
    host = "<a href="http://localhost:9200/_cluster/allocation/explain"" rel="nofollow" target="_blank">http://localhost:9200/_cluster ... ot%3B
    s= requests.Session()
    def reroute_shard(index,shard,node):
    data = {
    "commands" : [
    {
    "allocate_stale_primary" : {
    "index" : index, "shard" : shard, "node" : node, "accept_data_loss": True
    }
    }
    ]
    }
    print data
    url = "<a href="http://localhost:9200/_cluster/reroute"" rel="nofollow" target="_blank">http://localhost:9200/_cluster/reroute"
    res = s.post(url,json=data)
    print res

    def get_node(line):
    if "UNASSIGNED" in line:
    line = line.split()
    index = line[0]
    shard = line[1]
    if line[2] != "p":
    return
    body = {
    "index": index,
    "shard": shard,
    "primary": True
    }
    res = s.get(host, json = body)
    for store in res.json().get("node_allocation_decisions"):
    if store.get("store").get("allocation_id"):
    node_name = store.get("node_name")
    reroute_shard(index,shard,node_name)
    else:
    return

    with open("shards", 'rb') as f:
    map(get_node,f)
    ```

    相关文档:

elasticsearch安装插件需要重启的问题

Elasticsearchmedcl 回复了问题 • 5 人关注 • 1 个回复 • 5716 次浏览 • 2018-01-16 11:17 • 来自相关话题

社区日报 第139期 (2017-12-23)

社区日报bsll 发表了文章 • 0 个评论 • 2343 次浏览 • 2017-12-23 08:57 • 来自相关话题

1、iPrice集团使用elasticsearch集群经验分享
http://t.cn/RTkTb0f
2、使用Elassandra(Elasticsearch+Apache  Cassandra)进行NBA球员数据探索
http://t.cn/RTkT7SV
3、如何使用kibana基于时间序列的Visual  Builder展示数据
http://t.cn/RTkJX5s
4、Elastic Advent Calendar Day 22:忘记elastic密码的解决办法
http://t.cn/RTkWoRR

编辑:bsll
归档:https://elasticsearch.cn/article/430
订阅:https://tinyletter.com/elastic-daily

elastcsearch批量删除重复的document

Elasticsearchguoyuan 回复了问题 • 4 人关注 • 3 个回复 • 5274 次浏览 • 2020-09-17 16:32 • 来自相关话题

Elasticsearch 内存泄漏 oom 没有bulk输入

回复

Elasticsearchcaomaocao 发起了问题 • 1 人关注 • 0 个回复 • 6788 次浏览 • 2017-12-22 18:15 • 来自相关话题

Kafka0.8之后,consumer信息从zk迁移走,如何拿到consumer的信息

回复

Kibanachenze 发起了问题 • 1 人关注 • 0 个回复 • 2311 次浏览 • 2017-12-22 15:05 • 来自相关话题

有没有创建kibana的index pattern的接口

Kibanaarterforyou 回复了问题 • 2 人关注 • 2 个回复 • 5680 次浏览 • 2018-01-18 17:29 • 来自相关话题

es搜索range

回复

Elasticsearchwangjie 发起了问题 • 1 人关注 • 0 个回复 • 2225 次浏览 • 2017-12-22 14:30 • 来自相关话题

elasticsearch出现查询慢如何排查问题

Elasticsearchkennywu76 回复了问题 • 4 人关注 • 1 个回复 • 16760 次浏览 • 2017-12-22 14:24 • 来自相关话题

es script 字段 如何进行多值搜索?

Elasticsearchmedcl 回复了问题 • 2 人关注 • 2 个回复 • 7295 次浏览 • 2018-01-16 11:25 • 来自相关话题

把日志输出到redis后,还能使用filebeat读取吗?

Beatskennywu76 回复了问题 • 2 人关注 • 1 个回复 • 3695 次浏览 • 2017-12-22 14:31 • 来自相关话题

请问下ES可以做类似sql的like,要后匹配的like,比如:like ‘aaaaa%’这样的

ElasticsearchLXJ 回复了问题 • 3 人关注 • 3 个回复 • 13982 次浏览 • 2018-01-08 17:43 • 来自相关话题

统计图书clcs字段中'建筑科学'出现的次数

Elasticsearchstrglee 回复了问题 • 2 人关注 • 1 个回复 • 1969 次浏览 • 2017-12-22 19:01 • 来自相关话题

elasticsearch副本分配不均

回复

Elasticsearchshitangjiejie 回复了问题 • 1 人关注 • 1 个回复 • 2409 次浏览 • 2017-12-22 11:12 • 来自相关话题

社区日报 第138期 (2017-12-22)

社区日报laoyang360 发表了文章 • 1 个评论 • 2080 次浏览 • 2017-12-22 06:42 • 来自相关话题

1、 NMAP扫描结果同步到Elasticsearch
http://t.cn/R94eGiz
2、elasticsearch对gmail建立索引?
http://t.cn/RZbYIug
3、es6.1的变化清单
http://t.cn/RTS7BcU
4、Elastic Advent Calendar Day 21:高性能Elasticsearch建议
http://t.cn/RTezts5

编辑:铭毅天下
归档:https://elasticsearch.cn/article/429
订阅:https://tinyletter.com/elastic-daily