记一次elasticsearch错误(SearchPhaseExecutionException: all shards failed)

记一次elasticsearch错误(SearchPhaseExecutionException: all shards failed)

一、问题
logstash突然无法对elasticsearch服务进行读写操作了,提示elasticsearch的地址有问题,检测elasticsearch发现端口存在。查看日志发现有报错。

二、问题原因
有一些索引的数据损坏了

三、解决

官网文档:https://www.elastic.co/guide/cn/elasticsearch/guide/cn/_cluster_health.html

1、查看索引信息

curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'

{
  "cluster_name" : "test",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 134,
  "active_shards" : 134,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 30,
  "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" : 98.19711538461539  #数据的正常率,100表示一切ok
}

2、查看所有所有的状态
green:所有的主分片和副本分片都已分配。你的集群是 100% 可用的。
yellow:所有的主分片已经分片了,但至少还有一个副本是缺失的。不会有数据丢失,所以搜索结果依然是完整的。不过,你的高可用性在某种程度上被弱化。如果 更多的 分片消失,你就会丢数据了。把 yellow 想象成一个需要及时调查的警告。
red:至少一个主分片(以及它的全部副本)都在缺失中。这意味着你在缺少数据:搜索只能返回部分数据,而分配到这个分片上的写入请求会返回一个异常。

curl  'localhost:9200/_cat/indices?v'

3、删除red状态的索引

 curl -XDELETE http://localhost:9200/index_name
  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值