简体   繁体   English

Elasticsearch - 什么是4节点集群的理想Shard配置

[英]Elasticsearch - Whats the ideal Shard config for 4 node cluster

I have 4 servers installed and running ES. 我安装了4台服务器并运行ES。 I am looking to setup 2 shards and corresponding replica (1 to 1 shard). 我期待设置2个分片和相应的副本(1到1个分片)。

My challenge is, do I need to make 2 nodes as masters and the other 2 nodes as just node datas? 我的挑战是,我是否需要将2个节点作为主节点而将其他2个节点作为节点数据?

The plan is 计划是

Node A acts as Master with 2 Primary Shards = Replica is Node B
Node C acts as Master with 2 Primary Shards = Replica is Node D

Is this an ideal configuration or is there a better alternative. 这是一个理想的配置还是有更好的选择。 Also since they are all clustered, when datas are pushed to the cluster, would either of the master node take responsibility to distribute the shard between the 2 master nodes? 此外,由于它们都是群集的,当数据被推送到群集时,主节点中的任何一个都会负责在两个主节点之间分配分片吗?

If I make all 4 nodes both master and data, which config settings will make node A primary shard and node B the replica or which config will tell node A that its replica is node B. Same for nodes C & D. 如果我将所有4个节点都设置为主节点和数据,那么配置设置将使节点A主要分片和节点B成为副本或哪个配置将告诉节点A其副本是节点B.对于节点C和D也是如此。

Thanks 谢谢

You have two separate problems here: 这里有两个不同的问题:

  • Cluster Topology 集群拓扑

    It is recommended to have exactly 3 master nodes in an Elasticsearch cluster. 建议在Elasticsearch集群中准确拥有3个主节点。 You need this to increase resiliency towards node failures and avoid split brain problems. 您需要这样做以增加对节点故障的弹性并避免裂脑问题。

    An Elasticsearch node can act both as master as well as data node. Elasticsearch节点既可以作为主节点也可以作为数据节点。 Note that if a node is set to be a master node but not data node, it cannot store any indexed data (read shards). 请注意,如果节点设置为主节点而不是数据节点,则它不能存储任何索引数据(读取分片)。 Hence depending on how much data you want to index, you can set one, two, three or even all four nodes as data nodes. 因此,根据您要索引的数据量,您可以将一个,两个,三个甚至所有四个节点设置为数据节点。

  • Data Topology 数据拓扑

    The number of primary and replica shards again depend on how much data you want to index and the disk capacity of the data nodes. 主分片和副本分片的数量还取决于您要索引的数据量和数据节点的磁盘容量。 If unsure, you can start with the default settings of 5 primary shards and 1 replica shard. 如果不确定,可以使用5个主分片和1个副本分片的默认设置开始。

Shards will only be present in data nodes (doesn't matter if they are also master nodes). 碎片仅存在于数据节点中(如果它们也是主节点则无关紧要)。 Regarding balancing shards between the data nodes, you don't need to worry about it; 关于平衡数据节点之间的分片,您不必担心它; master node will take care of it. 主节点将负责它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM