美文网首页
ES unassigned解决之重路由分配1

ES unassigned解决之重路由分配1

作者: bigdata张凯翔 | 来源:发表于2021-04-03 11:37 被阅读0次
    ES3台节点有一台挂掉重启之后怎么操作

    ====================================

    问题升级为:ES集群节点宕机导致shard unassigned解决方案

    https://blog.csdn.net/u012386386/article/details/78811618

    es集群中节点的具体信息
    curl 'http://ip:port/_nodes/process?pretty'

    查看处于未分配状态的信息,信息里面分别有索引,id等信息
    curl -XGET http://ip:port/_cat/shards|grep UNASSIGNED

    通过如下命令便可以完成shard的重新路由分配

    curl -XPOST 'ip:port/_cluster/reroute?retry_failed=5&pretty' -d '
    {
        "commands" : [ {
            "allocate_stale_primary" : {
                "index" : "error_data",
                "shard" :5,
                "node" : "0Al0NdJZS2ClT6PiLCqGlg",
                "accept_data_loss" : true
            }
        }]
    }'
    

    index为未分配的shard的索引,
    shard为分片id,
    node为分片的路由目的节点id,
    通过第一条命令可以查出,
    注意可能unassigned节点并不全部分布再宕机节点上,需要进行重路由分配,如果分片不在路由目的节点上,日志中会出现异常信息,找不到对应分片的索引文件,在异常信息中会出现分片的名称,这时,到各节点上查找分片信息,路由到对应的节点上。
    所有问题解决后,重启es集群可以发现集群变为green状态。

    问题升级为:elasticsearch :unassigned错误解决

    感谢大佬https://blog.csdn.net/wer724853863/article/details/78533105
    1、首先走命令行,查看目前有哪些es节点分片有问题
    curl -s "http://192.168.1.28:9200/_cat/shards" | grep UNASSIGNED
    2.查看节点为master的节点唯一标识
    curl 'localhost:9200/_nodes/process?pretty'
    curl -XGET http://localhost:9200/_cluster/health\?pretty

    问题升级为elasticsearch shard UNASSIGNED 修复

    https://blog.csdn.net/wer724853863/article/details/78533105
    查看集群健康状态:curl -XGET http://localhost:9200/_cluster/health\?pretty
    inde:需要修复的索引的名字(这里需要修复三个索引)
    shard:shard的编号,图中可以看出
    node:master节点的唯一标识

    curl -XPOST 'localhost:9200/_cluster/reroute' -d '
    {
    "commands" : [{
        "allocate" : {
        "index" : "rs_wx_test",
        "shard" : 1,
        "node" : "AfUyuXmGTESHXpwi4OExxx",
        "allow_primary" : true
        }
          }
      ] 
    }'
    

    感谢大佬:
    https://www.jianshu.com/p/4147c186c0d7?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

    问题升级为解决elasticsearch集群Unassigned Shards 无法reroute的问题

    感谢大佬:
    https://blog.csdn.net/D850076493/article/details/90288677?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-1&spm=1001.2101.3001.4242

    相关文章

      网友评论

          本文标题:ES unassigned解决之重路由分配1

          本文链接:https://www.haomeiwen.com/subject/amvtkltx.html