org.elasticsearch.cluster.block.ClusterBlockException:阻止者:[SERVICE_UNAVAILABLE/1/state 未恢复/初始化]
org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized]
我正在使用 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
}
假设您不关心数据(正如您在问题的评论中所说 - 您可以删除本地计算机中的 /opt/services/data/elasticsearch
文件夹
在您的容器 down
时执行此操作,然后再次 运行 up
。
解决 Elasticsearch 6.5.1 问题的步骤
- 禁用只读索引:
curl -X PUT "localhost:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only" : false } }'
- 重启非主节点
- 休息时查看索引状态 api:
curl http://10.146.64.42:9200/_cat/indices
- 查看集群运行状况:
curl http://10.146.64.42:9200/_cluster/health
一段时间后,弹性集群将return变为绿色健康状态。
我正在使用 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
}
假设您不关心数据(正如您在问题的评论中所说 - 您可以删除本地计算机中的 /opt/services/data/elasticsearch
文件夹
在您的容器 down
时执行此操作,然后再次 运行 up
。
解决 Elasticsearch 6.5.1 问题的步骤
- 禁用只读索引:
curl -X PUT "localhost:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only" : false } }'
- 重启非主节点
- 休息时查看索引状态 api:
curl http://10.146.64.42:9200/_cat/indices
- 查看集群运行状况:
curl http://10.146.64.42:9200/_cluster/health
一段时间后,弹性集群将return变为绿色健康状态。