我有三个elasticsearch数据节点:
{
"cluster_name" : "elastic_berries",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 5,
"number_of_data_nodes" : 3,
"active_primary_shards" : 50,
"active_shards" : 100,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0
}
当我删除第一个节点时,我进入这个状态,带有一些delayed_unassigned节点,这是正常的:
{
"cluster_name" : "elastic_berries",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 4,
"number_of_data_nodes" : 2,
"active_primary_shards" : 50,
"active_shards" : 66,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 34,
"delayed_unassigned_shards" : 34,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0
}
然后:
{
"cluster_name" : "elastic_berries",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 4,
"number_of_data_nodes" : 2,
"active_primary_shards" : 50,
"active_shards" : 66,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 34,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0
}
但是,我只请求一个副本,群集应自动分配未分配的分片并返回绿色状态。我必须手动运行此命令:
curl -XPUT' localhost:9200 / _cluster / settings' -d' { "暂态" :{ " cluster.routing.allocation.enable" :"所有" }'
回到绿色状态。有没有办法让这个功能自动化?