Elasticsearch Rolling Upgrade 또는 Node 작업시 클러스터 설정

By | 2019년 8월 6일

Elasticsearch 를 사용하다 보면 Node 를 업그레이드 하거나 서버 spec 변경 등 Node에 대한 작업을 해야 할 경우가 있다.

특히 데이터 노드를 올리고 내릴때에는 샤드가 리발란스 되는 동안 시스템 리소스를 잡아먹고 다시 데이터 노드가 붙으면 다시 리발란스 되어 또 한번 시스템 리소를 잡아 먹는 경우가 생긴다. (full replica 의 경우는 상관 없을듯)

이럴때 클러스터의 shard allocation 과 rebalance 를 잠시 중단시켜 작업하면 좋다.

shard allocation 및 rebalance 중단.

PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "none",
    "cluster.routing.rebalance.enable": "none"
  }
}

shard allocation 및 rebalance 시작

PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "all",
    "cluster.routing.rebalance.enable": "all"
  }
}