我有一个包含11个节点的Elasticsearch集群。其中五个是数据节点,其他五个是客户端节点,从中可以添加和检索文档。

我正在使用标准的Elasticsearch配置。每个索引有5个分片和副本。在集群中,我有55个索引,大约有150GB的数据。

群集非常慢。使用Kopf插件,我可以看到每个节点的统计信息。在那里,我可以看到一个数据节点(不是主节点)永久性过载。堆,磁盘,CPU都可以,但几乎每次负载都是100%。我注意到,每个分片都是主分片,而所有其他数据节点都具有主分片和副本。当我关闭该节点然后再次打开时,另一个数据节点也会发生相同的问题。

而且我不知道为什么以及如何解决这个问题。我认为客户端节点和主节点均匀分配请求?为什么总是一个数据节点过载?

最佳答案

尝试以下设置:

cluster.routing.rebalance.enable :

为特定种类的分片启用或禁用重新平衡:

    all - (default) Allows shard balancing for all kinds of shards.
    primaries - Allows shard balancing only for primary shards.
    replicas - Allows shard balancing only for replica shards.
    none - No shard balancing of any kind are allowed for any indices.

cluster.routing.allocation.allow_rebalance :

指定何时允许分片重新平衡:
    always - Always allow rebalancing.
    indices_primaries_active - Only when all primaries in the cluster are allocated.
    indices_all_active - (default) Only when all shards (primaries and replicas) in the cluster are allocated.

cluster.routing.allocation.cluster_concurrent_rebalance :

允许控制在群集范围内允许多少并发分片重新平衡。
Defaults to 2

样品卷度以应用所需的设置:
curl -XPUT <elasticsearchserver>:9200/_cluster/settings -d '{
  "transient" : {
    "cluster.routing.rebalance.enable" : "all"
  }
}

如果您希望设置在重启后保持不变,则可以将transient替换为persistent

07-28 02:08
查看更多