确保群集状态为绿色的最小节点数是多少? [英] What's the minimum number of nodes that assures the state of the cluster is green?

查看:40
本文介绍了确保群集状态为绿色的最小节点数是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个节点的集群,并按如下所示设置分片号和副本号的配置:

I have a cluster of two nodes, and set the configs for shard number and replica number as following:

index.number_of_shards:10
index.number_of_replicas:1

index.number_of_shards: 10
index.number_of_replicas: 1

主节点是自动选举的.

在索引数据之前,群集的状态为绿色.在索引数据之后,群集的状态变为黄色.某些副本分片未分配.

Before I index data, the state of the cluster is green. After I index data, the state of the cluster becomes yellow. Some replica shards are not allocated.

但是,如果我添加另一个节点,现在群集由三个节点组成,那么我将为数据建立索引,群集的状态将变为绿色.

But if I add another node and now the cluster consists of three nodes, then I index data and the state of the cluster becomes green.

我使用的ES版本是1.1.

The version of ES that I use is 1.1.

问题1:
如果副本号为1,我是否必须至少有3个节点才能确保群集的状态为绿色?

Question 1:
If the replica number is 1, do I have to have at least 3 nodes to assure the state of the cluster is green?

问题2:
我观察到三个节点中的一个(不是主节点)只有主节点.ES用来分配主/Replia分片的机制是什么?

Question 2:
I have observed that one (not the master node) of the three nodes just has primary nodes. What's the mechanism ES uses to allocate primary/replia shards?

谢谢.

更新

第一个问题是由不同版本的ES引起的.在我之前的测试中,一个节点使用ES-1.1.1,另一个节点使用ES-1.1.2.在群集的每个节点使用相同版本的ES之后,第一个问题就消失了.

The first problem is caused by different versions of ES. In my previous test, one node use ES-1.1.1 and the other uses ES-1.1.2. After every node of the cluster uses the same version of ES, then the first problem disappears.

推荐答案

答案1) 如果您提及

Answer 1) If you mention

 index.number_of_shards: 10
 index.number_of_replicas: 1

这意味着您的索引被分为10个分片,而1个副本意味着每个索引分片都有一个副本分片,因此您总共将拥有20个分片.

It means your index is split into 10 shards and 1 replica means there is one replica shard for each shard of index.therefore you will have 20 shards totally.

在ES中,主要分片和副本分片未分配在同一节点中.因此,如果您有1个副本,则必须有2个节点才能使节点状态保持绿色.

IN ES the primary shard and replica shard are not allocated in same node.So if you have 1 replica you must have 2 nodes to keep the node status green.

 Number of nodes to keep the cluster state green=NO of replica+1

答案2) 在索引的分片中,ES选择完成写入的一个主分片,主节点不必包含主分片.如果节点发生故障而包含主碎片,则相应的副本碎片将成为主碎片.您的数据将被保存.

Answer 2) Among shards of index, ES choose one primary shards where writes are done.It is not necessary, that master node should contain primary shard.Shards are distributed among nodes.If a node fails that contains primary shard ,then corresponding replica shard become as primary.You data will be saved.

了解ES的基础知识 引用

To understand basics of ES Refer

希望有帮助..!

这篇关于确保群集状态为绿色的最小节点数是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆