gpt4 book ai didi

elasticsearch - 删除未分配的Elasticsearch分片

转载 作者:行者123 更新时间:2023-12-02 22:26:14 37 4
gpt4 key购买 nike

我的安装运行正常,但是由于其中显示了2个“未分配”的未分配碎片,因此一个索引显示黄色运行状况。如何删除这些多余的碎片?我当前的设置是0个副本和2个分片。

curl -XGET 'http://localhost:9200/_cluster/health/tags?level=shards&pretty=true'
{
"cluster_name" : "elasticsearch_inspire",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 2,
"active_shards" : 2,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 2,
"indices" : {
"v1_tags" : {
"status" : "yellow",
"number_of_shards" : 2,
"number_of_replicas" : 1,
"active_primary_shards" : 2,
"active_shards" : 2,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 2,
"shards" : {
"0" : {
"status" : "yellow",
"primary_active" : true,
"active_shards" : 1,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1
},
"1" : {
"status" : "yellow",
"primary_active" : true,
"active_shards" : 1,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1
}
}
}
}
}

最佳答案

我最近遇到了一个问题,其中ES进程在所有节点上都重新启动,并且我有一些未分配的分片(集群运行状况为红色)。
我做了以下手动分配分片的工作,这对我来说是窍门(无需重新启动)

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
"commands": [
{
"allocate": {
"index": "INDEXNAME",
"shard": "SHARDNUMBER",
"node": "PICKANODE",
"allow_primary": 1
}
}
]
}'

关于elasticsearch - 删除未分配的Elasticsearch分片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18410243/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com