You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Otis Gospodnetic <ot...@gmail.com> on 2014/01/16 05:59:47 UTC

Q about majority voting, # of nodes, even node number

Hi,

Somebody asked me recently and I "got stuck" trying to explain this.
When people ask how many ZK nodes they should have a common answer is "odd
number: 3 or 5 or ...", so ZK can do majority voting.  Correct so far?
Another reason is for HA - if one ZK node dies, there are still 2 of them
left.  And this is where I am missing something core - with just 2 nodes
left, how can ZK do majority voting now?

Thanks,
Otis
--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/

Re: Q about majority voting, # of nodes, even node number

Posted by Henry Robinson <he...@cloudera.com>.
The answer, as Cameron says, is that 2 nodes still represent a majority in
a quorum of 3. The idea behind it is that if you have two different sets of
nodes that are large enough to be majorities, at least one node will be in
common between the two. This means that every majority has at least one
node that has heard of every transaction in the system, and this property
is crucial for the correctness of many consensus protocols.


On 15 January 2014 21:05, Cameron McKenzie <mc...@gmail.com> wrote:

> My understanding (which is admittedly limited):
>
> There are 2 nodes left out of 3, so when both machines respond they will
> get 2/3 of the vote, thus forming a majority. If you only had 2 machines in
> your cluster for example, then if 1 died, then the others vote would only
> make up 1/2 of the vote, which is not the majority, so you get no extra
> redundancy in having 2 machines over having 1.
>
>
> On Thu, Jan 16, 2014 at 3:59 PM, Otis Gospodnetic <
> otis.gospodnetic@gmail.com> wrote:
>
> > Hi,
> >
> > Somebody asked me recently and I "got stuck" trying to explain this.
> > When people ask how many ZK nodes they should have a common answer is
> "odd
> > number: 3 or 5 or ...", so ZK can do majority voting.  Correct so far?
> > Another reason is for HA - if one ZK node dies, there are still 2 of them
> > left.  And this is where I am missing something core - with just 2 nodes
> > left, how can ZK do majority voting now?
> >
> > Thanks,
> > Otis
> > --
> > Performance Monitoring * Log Analytics * Search Analytics
> > Solr & Elasticsearch Support * http://sematext.com/
> >
>



-- 
Henry Robinson
Software Engineer
Cloudera
415-994-6679

Re: Q about majority voting, # of nodes, even node number

Posted by Cameron McKenzie <mc...@gmail.com>.
My understanding (which is admittedly limited):

There are 2 nodes left out of 3, so when both machines respond they will
get 2/3 of the vote, thus forming a majority. If you only had 2 machines in
your cluster for example, then if 1 died, then the others vote would only
make up 1/2 of the vote, which is not the majority, so you get no extra
redundancy in having 2 machines over having 1.


On Thu, Jan 16, 2014 at 3:59 PM, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

> Hi,
>
> Somebody asked me recently and I "got stuck" trying to explain this.
> When people ask how many ZK nodes they should have a common answer is "odd
> number: 3 or 5 or ...", so ZK can do majority voting.  Correct so far?
> Another reason is for HA - if one ZK node dies, there are still 2 of them
> left.  And this is where I am missing something core - with just 2 nodes
> left, how can ZK do majority voting now?
>
> Thanks,
> Otis
> --
> Performance Monitoring * Log Analytics * Search Analytics
> Solr & Elasticsearch Support * http://sematext.com/
>