Hello,World

主分片丢失这种情况怎么办

Elasticsearch | 作者 Charele | 发布于2022年04月20日 | 阅读数:1648

节点es1当机,起不来了。
怎么使这个索引变成绿的。es1上面的数据丢失无所谓。

111.png


222.png

 
你的问题补充太简单了,一个详细的问题描述能够让大家更快的帮助你,请继续完善问题描述!
已邀请:

Ombres

赞同来自:

POST /_cluster/reroute
{
  "commands": [
    {
      "allocate_stale_primary": {
        "index": "{indexName}",
        "shard": 9,
        "node": "",
        "accept_data_loss": true
      }
    }
  ]
}
 

CobraDan

赞同来自:

允许数据丢失并重建主分片的话可以执行:
curl -XPOST '<your-es-ip>:<es-http-port>/_cluster/reroute' --header "Content-Type: application/json" -d '{ "commands" :
  [ { "allocate_empty_primary" :
      { "index" : "<待修复索引>", "shard" : <待修复分片号>, "node": "<需要修复至目标节点的node_name>" ,"accept_data_loss": true}
  }]
}'
详细可以参考官方文档Cluster reroute API的用法

要回复问题请先登录注册