Es:org.elasticsearch.action.search.SearchPhaseExecutionException: all shards fai

429 阅读1分钟

1.查看集群状态:为'red'则状态不正确,需要删除对应的index

curl -XGET 'http://localhost:9201/_cluster/health?pretty=true'
{
  "cluster_name" : "docker-cluster",
  "status" : "yellow", ##状态为yellow
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 10,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 5,
  "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" : 66.66666666666666 #最好为100%
}

2.查看索引状态:

curl -XGET http://127.0.0.1:9201/_cat/indices?v

image.png

3.删除状态为'red'的索引:

curl -XDELETE http://127.0.0.1:9201/test4

4.禁用Es的分片:

curl -X PUT "http://localhost:9201/_settings" -H 'content-Type:application/json'  -d' {  "number_of_replicas" : 0 }'