Er.Garvesh
Er.Garvesh

Reputation: 131

org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized]

I am using ELK 6.8.9 all configuration is in my docker-compose file. It was working fine but when suddenly I am getting an error of

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

This is how I configure 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}

on calling

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
}

Upvotes: 6

Views: 13998

Answers (2)

Leonardo Meza N.
Leonardo Meza N.

Reputation: 71

Steps to solve Elasticsearch 6.5.1 issue

  1. Disable read only indices:
curl -X PUT "localhost:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only" : false } }'
  1. Restart non master nodes
  2. Review indices status by rest api:
curl http://10.146.64.42:9200/_cat/indices
  1. Review cluster health:
curl http://10.146.64.42:9200/_cluster/health

After a while, the elastic cluster will return to green health status.

Upvotes: 1

ItayB
ItayB

Reputation: 11367

Assuming you don't care about the data (as you said in the comments of the question - you can delete your /opt/services/data/elasticsearch folder in your local machine

Do that while your container is down and then run up again.

Upvotes: 1

Related Questions