LoginSignup
12
12

More than 5 years have passed since last update.

[Elasticsearch]Cluster Healthのstatus が yellow となる

Posted at

バージョン

  • Elasticsearch 2.3.4
  • ノードは一つ
  • Kibana から Elasticsearch へ接続済み

内容

Elasticsearch を構築したぞ!となって Cluster Health を確認したら以下のように Status が yellowに

$curl http://10.66.35.30:9200/_cluster/health?pretty=true
{
  "cluster_name" : "elasticsearch",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 1,
  "active_shards" : 1,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 1,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 50.0
}

そもそも yellow とはどのような状態か。こちらは公式ドキュメントに記載あり。

Cluster Health

yellow means that the primary shard is allocated but replicas are not

なるほど。プライマリーシャードは割り当たっているけどレプリカシャードが割り当たってないと。なので、unassigned_shards も 1 で active_shards_percent_as_number も 50 になっているのだろう。

今回の場合には kibana 用のインデックスがあるが、こちらの設定で active_shards_percent_as_number が1となっており、レプリケーションを作るようになっているが、ノードがなく作成できないため、このようになっているっぽい。

$curl -s http://10.66.35.30:9200/.kibana/_settings | jq
{
  ".kibana": {
    "settings": {
      "index": {
        "creation_date": "1469610418434",
        "number_of_shards": "1",
        "number_of_replicas": "1",
        "uuid": "CMdCyVezSJeA90KmUVNiTw",
        "version": {
          "created": "2030499"
        }
      }
    }
  }
}

どうすればよい?

ノードを追加すればOK。
実際別環境でノードを追加したら status が green になった。
number_of_replicas を 0 にするという方法もあるかもしれないが(試してない)、出来たとしてもこれは良い方法ではない気がする。。。

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12