Elasticsearch 集群 yellow/red 的定位与修复
_cluster/health 返回 yellow 或 red。yellow 表示主分片可用但副本未分配;red 表示至少一个主分片未分配,部分索引不可用。
curl -s 'http://es:9200/_cluster/health?pretty'
curl -s 'http://es:9200/_cat/shards?v'
curl -s 'http://es:9200/_cat/nodes?v'
curl -s 'http://es:9200/_cluster/allocation/explain?pretty'
curl -s 'http://es:9200/_cat/allocation?v'
allocation/explain 的具体原因,不要盲目 reroute。cluster.routing.allocation.* 和分片上限。POST /_cluster/reroute,但确认不会丢数据。elasticsearch — 服务端curl — REST APIkibana — 集群查看