[英]Unassigned shards of the index in ElasticSearch
我的ElasticSearch集群中有未分配的分片,但我不知道如何解決。 我已經刪除了索引並再次創建了索引,但是圖片仍然相同。
如何解決?
-編輯----
{
"cluster_name": "node_name",
"status": "yellow",
"timed_out": false,
"number_of_nodes": 2,
"number_of_data_nodes": 2,
"active_primary_shards": 8,
"active_shards": 12,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 4,
"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": 75
}
我發現了問題! 節點2.3.1和2.2.0有2個不同的版本。 因為我昨天用當前版本更新了ElasticSearch,所以第二個節點應該手動更新,因為它在同一服務器上。 因為版本不同,所以存在未被認可的碎片。
謝謝!
以下是可以強制修復的bash(將服務器名稱更改為目標節點的名稱):
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do
INDEX=$(echo $line | (awk '{print $1}'))
SHARD=$(echo $line | (awk '{print $2}'))
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
"commands": [
{
"allocate": {
"index": "'$INDEX'",
"shard": '$SHARD',
"node": "SERVER_NAME_OF_THE TARGET_NODE",
"allow_primary": true
}
}
]
}'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.