[Elasticsearch] Shard reroute (6.x)

Elastic/Elasticsearch 2019. 7. 11. 13:29

공식문서)

https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cluster-reroute.html

 

Cluster Reroute | Elasticsearch Reference [7.2] | Elastic

The reroute command allows for manual changes to the allocation of individual shards in the cluster. For example, a shard can be moved from one node to another explicitly, an allocation can be cancelled, and an unassigned shard can be explicitly allocated

www.elastic.co

 

6.x 와 7.x 간에 차이 없이 사용 하실 수 있습니다.

 

POST _cluster/reroute
{
  "commands": [
    {
      "allocate_replica": {
        "index": "actlog-2019-07-05",
        "shard": 0,
        "node": "노드명"
      }
    }
  ]
}

POST _cluster/reroute
{
  "commands": [
    {
      "move": {
        "index": "actlog-2018-12-27",
        "shard": 0,
        "from_node": "노드명1",
        "to_node": "노드명2"
      }
    }
  ]
}

공식 문서에 설명이 잘 나와 있어서 제가 특별히 설명을 하지 않아도 될 것 같습니다.

 

move)

started shard 에 대해서 가능 합니다.

 

allocate_replica)

unassigned replica shard 에 대해서 가능 합니다.

 

이번에 제가 사용하게 된 이유는 데이터 노드 3개 중에 하나의 노드의 disk 가 85% 를 넘어서 replica shard 가 unassigned 되는 문제가 발생을 했습니다.

그래서 수동으로 임시 조치 하기 위해 reroute 했고요.

근본적인 해결 방법은 disk 용량을 확보 하시는 것입니다. 또는 85% 가 넘지 않도록 rolling 하시면 됩니다.

: