DBAtlas · 数据库运维图谱

red/yellow 集群排查流程(哪个索引、哪个分片、为什么)

Elasticsearch集群/节点

命令

GET _cluster/health?filter_path=status,unassigned_shards,initializing_shards,delayed_unassigned_shards,number_of_pending_tasks
GET _health_report?verbose=false
GET _cat/indices?v&health=red&h=health,index,pri,rep,docs.count,store.size
GET _cat/indices?v&health=yellow&h=health,index,pri,rep
GET _cat/shards?v&h=index,shard,prirep,state,unassigned.reason,unassigned.for,node&s=state
# Without a body, the call explains the first unassigned shard:
GET _cluster/allocation/explain

作用

给出有序的排查流程:从集群状态到问题索引,再到未分配分片及其未被分配的原因(unassigned.reason、allocation explain);_health_report 汇总哪个指标(磁盘、分片可用性、主节点)不健康。

适用场景

作为集群变为 red 或 yellow 时的第一响应。

注意

red:至少有一个主分片未分配;对该索引的写入以及命中该分片的搜索会失败。yellow:所有主分片都在,但缺少副本;数据可访问但没有冗余。在单节点集群上,replicas > 0 的索引会一直保持 yellow(same_shard 决策)。若有节点刚离开,delayed_unassigned_shards 会被有意保留,直到 index.unassigned.node_left.delayed_timeout(默认 1m)到期。

在 DBAtlas 中打开 →

相关内容