org.elasticsearch.cluster.block.ClusterBlockException:ブロック:[SERVICE_UNAVAILABLE / 1 /状態が回復/初期化されていません]

Dec 16 2020

ELK 6.8.9を使用していますが、すべての構成はdocker-composeファイルにあります。正常に動作していましたが、突然エラーが発生しました

org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
or org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];

これが私がELKを設定する方法です

   elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.8.9
    environment:
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    volumes:
      - /opt/services/data/elasticsearch:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    user: ${USER_ID}

電話で

curl -XGET 'localhost:9200/_cluster/health/balance_sheet?pretty'-- request
response -clear
{
  "cluster_name" : "docker-cluster",
  "status" : "red",
  "timed_out" : true,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "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" : 100.0
}

回答

ItayB Dec 16 2020 at 15:15

データを気にしないと仮定します(質問のコメントで言ったように-/opt/services/data/elasticsearchローカルマシンのフォルダを削除できます

コンテナが存在する間にdownそれを実行upしてから、再度実行します。