我有一个包含10个节点的弹性搜索群集,这些节点分为3个区域(A
,B
,C
)。
ES配置文件包含:
cluster.routing.allocation.awareness.force.zone.values = "A,B,C";
我有一个索引(index1
),其中包含=~ 283674
个文档,大小为=~ 231MB
。
此索引的设置包含:
"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 :(得分:1)
我通过强制每个主机的分片数量和更改每个索引的主要/辅助数量来修复此问题:
index.number_of_shards = "5";
index.number_of_replicas = "3";
index.routing.allocation.total_shards_per_node = "2";
这导致每个节点有2个分片在区域内均匀分布。