Open2

Elasticsearch周りのメモ

taxintaxin

NodeのRolling upgrade (Es Cluster構成)

  • 概要
    • shardの移動を事前に止める (/_cluster/settings)
    • Nodeの再起動時も含めてshardの移動を継続的に止める際にはpersistentの設定を利用する
      • transient, where they don't survive a full cluster restart
      • (最後に元に戻すのは必ず忘れないこと)
    • shardの状況は/_cat/shards?vで確認できる
// 利用するコマンド(一部省略)
// 事前にshard, indexなどのstatusを確認する
curl http://$(hostname):9200/_cat/indices?v

// shardの移動を停止
curl -X PUT -H 'Content-Type: application/json' http://$(hostname):9200/_cluster/settings -d'
{
  "persistent": {
    "cluster.routing.allocation.enable": "none"
  }
}'

// shardの状況は下記で確認できる
curl http://$(hostname):9200/_cat/shards?v | sort
curl http://$(hostname):9200/_cat/shards?v | sort | grep UNASSIGNED

// shardの移動をenableにする
curl -X PUT -H 'Content-Type: application/json' http://$(hostname):9200/_cluster/settings -d'
{
  "persistent": {
    "cluster.routing.allocation.enable": "all"
  }
}'

// shardの移動をenableにした上で、shard, clusterのstatus確認を行う
curl http://$(hostname):9200/_cluster/health?pretty