2014-08-27 55 views
1

我有一个elasticsearch集群,包含跨3个区域(AB,C)分裂的10个节点。Elasticsearch路由分配的可能性和分片分配

的ES的配置文件包含:

cluster.routing.allocation.awareness.force.zone.values = "A,B,C"; 

我有一个包含=~ 283674文档尺寸为=~ 231MB单个索引(index1)。 这个指标的设置包括:

"number_of_replicas" : "2", "number_of_shards" : "5", 

碎片似乎整个区域,但它们不是均匀分布的单一区域中正确分配(见下表,如C区| S =碎片,(P =小学| S =中学)

我能做些什么,以正确分配我的碎片

++------+----------------------------------------------------+ 
||Zone A-----------------------------------------------------| 
||  |             || 
|| Node 1| S1 (P)           || 
|| +-----------------------------------------------------+ || 
||  |             || 
||  | S2 (S)   S4 (S)       || 
||  |             || 
|| Node 2|             || 
|| +-----------------------------------------------------+ || 
||  |             || 
||  |             || 
||  | S0 (S)   S3 (S)       || 
||  |             || 
|| Node 3|             || 
|-------+----------------------------------------------------| 
||Zone B-----------------------------------------------------| 
||  |             || 
||  | S0 (P)           || 
|| Node 4|             || 
|| +-----------------------------------------------------+ || 
||  |             || 
||  |             || 
||  | S3 (P)   S4 (P)       || 
|| Node 5|             || 
|| +-----------------------------------------------------+ || 
||  |             || 
||  |             || 
||  | S1 (S)   S2 (S)       || 
|| Node 6|             || 
|-------+----------------------------------------------------| 
||Zone C-----------------------------------------------------| 
||  |             || 
||  | S0 (S) S1 (S) S2 (P) S3 (S) S4 (S)  || 
|| Node 7|             || 
|| +------------------------------------------------------+ || 
||  |             || 
||  |             || 
||  |             || 
|| Node 8|             || 
|| +------------------------------------------------------+ || 
||  |             || 
||  |             || 
||  |             || 
|| Node 9|             || 
|| +------------------------------------------------------+ || 
||  |             || 
||  |             || 
||  -             || 
|| Node 10             || 
|------------------------------------------------------------| 
+------------------------------------------------------------+ 
+0

你是否在使用elasticsearch集群管理员的任何一种用户界面? (如elasticsearch-head) – eliasah 2014-08-27 15:16:14

回答

1

我通过强迫每个主机碎片的数量和改变初级/每指数二次数量固定的问题:?

index.number_of_shards = "5"; 
index.number_of_replicas = "3"; 
index.routing.allocation.total_shards_per_node = "2"; 

这会导致每个节点均匀分布2个分片。