确保群集状态为绿色的最小节点数是多少?

编程入门 行业动态 更新时间:2024-10-25 22:28:11
本文介绍了确保群集状态为绿色的最小节点数是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

希望有帮助..!

更多推荐

确保群集状态为绿色的最小节点数是多少?

本文发布于:2023-11-25 15:52:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630376.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:小节   点数   状态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!