我的群集处于黄色状态,因为某些分片未分配.该怎么办?
我尝试设置cluster.routing.allocation.disable_allocation = false所有索引,但我认为这不起作用,因为我使用的是1.1.1版本.
我也尝试重新启动所有机器,但同样的情况发生了.
任何的想法?
编辑:
群集统计:
{
cluster_name: "elasticsearch",
status: "red",
timed_out: false,
number_of_nodes: 5,
number_of_data_nodes: 4,
active_primary_shards: 4689,
active_shards: 4689,
relocating_shards: 0,
initializing_shards: 10,
unassigned_shards: 758
}
Run Code Online (Sandbox Code Playgroud)Alc*_*zar 108
分配不会发生的原因有很多:
作为一般规则,您可以解决以下问题:
curl -s 'localhost:9200/_cat/nodes?v'.如果您只有一个节点,则需要设置number_of_replicas为0.(请参阅ES文档或其他答案).curl -s 'localhost:9200/_cat/allocation?v'curl 'http://localhost:9200/_cluster/settings?pretty'并查找cluster.routing设置curl -s localhost:9200/_cat/shards?v | grep UNASS尝试强制分配分片
curl -XPOST -d '{ "commands" : [ {
"allocate" : {
"index" : ".marvel-2014.05.21",
"shard" : 0,
"node" : "SOME_NODE_HERE",
"allow_primary":true
}
} ] }' http://localhost:9200/_cluster/reroute?pretty
Run Code Online (Sandbox Code Playgroud)查看响应并查看其内容.会有一堆YES是好的,然后是NO.如果没有任何NO,则可能是防火墙/ SELinux问题.
小智 50
这是默认索引设置引起的常见问题,尤其是当您尝试在单个节点上进行复制时.要使用瞬态群集设置解决此问题,请执行以下操作
curl -XPUT http://localhost:9200/_settings -d '{ "number_of_replicas" :0 }'
Run Code Online (Sandbox Code Playgroud)
接下来,启用群集重新分配分片(您可以在完成所有操作后始终打开它):
curl -XPUT http://localhost:9200/_cluster/settings -d '
{
"transient" : {
"cluster.routing.allocation.enable": true
}
}'
Run Code Online (Sandbox Code Playgroud)
现在请坐下来观看群集清理未分配的副本分片.如果您希望此功能在将来的索引中生效,请不要忘记使用以下设置修改elasticsearch.yml文件并退回群集:
index.number_of_replicas: 0
Run Code Online (Sandbox Code Playgroud)
eli*_*sah 18
那些未分配的分片实际上是来自主节点的实际分片的未分配副本.
为了分配这些分片,您需要运行一个新的elasticsearch实例来创建一个辅助节点来承载数据副本.
编辑:有时未分配的分片属于已删除的索引,这使得它们孤立的分片无论是否添加节点都不会分配.但事实并非如此!
Edi*_*Edi 10
唯一对我有用的是更改number_of_replicas(我有2个副本,所以我将其更改为1然后再更改为2).
第一:
PUT /myindex/_settings
{
"index" : {
"number_of_replicas" : 1
}
}
Run Code Online (Sandbox Code Playgroud)
然后:
PUT /myindex/_settings
{
"index" : {
"number_of_replicas" : 2
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
78117 次 |
| 最近记录: |