Elasticsearch クラスターは、多くの統計情報を提供します。その中で、クラスターのステータスは最も重要な指標です。 クラスターのステータスには、[赤][黄][緑] の 3 つがあります。

クラスターのステータスは、次のコマンドを使用して確認できます。

curl -u user name:password http://domain:9200/_cluster/health

クラスターのステータス

ステータス 備考
一部のプライマリシャードが使用できません。 クラスターには、使用できないプライマリシャードが含まれています。つまり、1 つ以上のインデックスのプライマリシャードが unassigned です。
すべてのプライマリシャードが使用可能ですが、一部のレプリケートシャードは使用できません。 1 つ以上のレプリケートインデックスのプライマリシャードが unassigned です。
すべてのプライマリシャードとレプリケートシャードが使用可能です。 クラスターのすべてのインデックスは正常で、すべてのシャードが assigned です。

Elasticsearch クラスターのステータスが [緑] になるようにするには、すべてのプライマリシャードとレプリケートシャード が常に利用可能でなければなりません。

トラブルシューティング

クラスターのステータスが [黄]

クラスターのステータスが [黄] の場合、パスワード変更またはアップグレードの操作に時間がかかります。

クラスターのステータスが [緑] の場合に操作することを推奨します。 クラスターのステータスが [黄] になるのは、インデックスの一部のレプリケートシャードが unassigned であるためです。 クラスター内で問題のあるインデックスを確認する必要があります。

インデックスステータスのクエリコマンド
curl -u user name:password http://domain:9200/_cat/indices
# Find out the problematic index name. If the reason is that the number_of_replicas is larger than amount_Node – 1,
# change the number_of_replicas of the problematic index.
インデックスステータスの復元コマンド
curl -XPUT -u user name:password http://domain:9200/problematic index name/_settings -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":(amount_Node – 1)}'
# For example, if the number of requested instance nodes is 3 but the number_of_replicas of an index is also 3, the cluster health status is yellow.
# Change the number_of_replicas of the problematic index to 2.

インスタンスに対する操作 (再起動/スケールアップ/カスタム設定) が終了したら、インスタンスのノードの数に応じて number_of_replicas を設定します。 これにより、Elasticsearch サービスの信頼性と安定性が向上します。