# 查看所有索引状态
curl -XGET "http://*:9200/_cat/indices?pretty"
# 查看异常索引状态
curl -XGET "http://*:9200/_cat/indices?v&health=red"
curl -XGET --user user:passwd -XGET 'http://ip:9200/_cat/shards/skywalking_metrics-longavg-20221127?v'
查看分片分配不成功的原因
curl -XGET --user elastic:F3Ag1IOK7eupkTrRB1vE -XGET 'http://192.168.24.202:9201/_cat/shards/skywalking_metrics-longavg-20221127?v&h=n,index,shard,prirep,state,sto,sc,unassigned.reason,unassigned.details"
报错如下
ALLOCATION_FAILED failed shard on node [pesDvSirRcOJuHS-8xJTeQ]: failed to create shard, failure IOException[failed to obtain in-memory shard lock]; nested: ShardLockObtainFailedException[[skywalking_metrics-lard creation] trying to lock for [shard creation]];
ALLOCATION_FAILED failed shard on node [pesDvSirRcOJuHS-8xJTeQ]: failed to create shard, failure IOException[failed to obtain in-memory shard lock]; nested: ShardLockObtainFailedException[[skywalking_metrics-longavg-20221127][1]: obtaining shard lock timed out after 5000ms, previous lock details: [shard creation] trying to lock for [shard creation]];
处理办法
POST /_cluster/reroute?retry_failed=true
curl --user user:passwd -XGET 'http://ip:9200/_cat/indices?v'
curl --user user:passwd -XGET 'http://ip:9200/_cat/allocation?v