其他分享
首页 > 其他分享> > elasticsearch重启后,unassigned索引重新分片失败YELLO、RED恢复处理

elasticsearch重启后,unassigned索引重新分片失败YELLO、RED恢复处理

作者:互联网

文章目录

现象

排查与处理

信息查看

集群状态

节点状态

索引状态

分片状态

原因探究

查看unsigned原因

主动重新分片

curl -XPOST 'http://10.209.180.72:9200/_cluster/reroute?retry_failed=true'
curl -H "Content-Type: application/json" -X POST -d  '{
    "commands": [
    {
      "allocate_stale_primary": {
        "index": "gov_c",
        "shard": 1,
        "node": "node-3-74-9200",
        "accept_data_loss" : true
      }
    }
  ]
}' "http://10.209.180.72:9200/_cluster/reroute"
curl -H "Content-Type: application/json" -X POST -d  '{
    "commands": [
    {
      "allocate_replica": {
        "index": "gov_c",
        "shard": 1,
        "node": "node-3-74-9200"
      }
    }
  ]
}' "http://10.209.180.72:9200/_cluster/reroute"

主动分片失败解决

如果以上还是失败,则说明问题不小,要做好数据丢失的心理准备

curl -XGET 'http://10.209.180.72:9200/_cluster/allocation/explain?pretty'
curl http://10.209.180.72:9200/_cat/recovery?v&h=i,s,t,ty,st,shost,thost,f,fp,b,bp,to,tor,top&active_only
curl http://10.209.180.72:9200/gov_c/_recovery?pretty=true
bin/elasticsearch-translog truncate -d data/nodes/0/indices/3t1xcXNXTqa4yLWi5mShrw/1/translog

标签:10.209,http,9200,YELLO,unassigned,180.72,分片,elasticsearch,curl
来源: https://blog.csdn.net/u010882234/article/details/122343497