NAS异常关机过后,导致Kibana无法正常启动,Kibana和需要连接elasticsearch8.2都有爆出错误
出现问题,当然就要从日志文件下手,先定位出问题可能出现在哪
Kibana
这边返回了一个比较重要的错误信息
1 |
Action failed with 'no_shard_available_action_exception: [no_shard_available_action_exception] Reason: No shard available for [get [.tasks][Pmi_cNHLSqix9Ld4IkBRjA:1817007]: routing [null]]'. Retrying attempt 1 in 2 seconds. |
看起来.task索引出现了问题, 先确认下elasticsearch服务器的当前状态
请求curl -H 'Content-type: application/json' -XGET 'http://192.168.0.1:9200/_cluster/health'
, 返回如下内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
{ "cluster_name": "docker-cluster", "status": "red", "timed_out": false, "number_of_nodes": 1, "number_of_data_nodes": 1, "active_primary_shards": 175, "active_shards": 175, "relocating_shards": 0, "initializing_shards": 0, "unassigned_shards": 159, "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": 52.39520958083832 } |
看得出来明显不健康, status已经为red了
继续使用curl -s 'http://192.168.0.1:9200/_cat/shards' | grep .tasks
, 发现.task
处于UNASSIGNED
状态
解决方案
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// 重新给.task分配一个空的主分片,注意, 该索引数据会丢失!数据会丢失!数据会丢失! // index, shard和node需要自己手动修改, 按照/_cat/shard返回的内容来就行 curl -XPOST 'http://192.168.0.1:9200/_cluster/reroute' -d '{ "commands": [ { "allocate_empty_primary": { "index": "'$INDEX'", "shard": '$SHARD', "node": "'$NODE'", "accept_data_loss": true } } ] }' |