# zookeeper-user mailing list archives

##### Site index · List index
Message view
Top
From Flavio Junqueira <fpjunque...@yahoo.com.INVALID>
Subject Re: Multi DC ( DC-1 and DC-2) zookeeper setup
Date Sat, 12 Dec 2015 14:37:52 GMT
```Hi Kaushal,

> On 12 Dec 2015, at 04:07, Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:
>
> Hi,
>
> I have couple of questions which are as below :-
>
> 1) In a 3 node single ensemble, i have 1 leader and 2 followers. when i
> triggers in between the remaining 2 nodes and i see that one of the node
> becomes a leader and the other is a follower. I am not sure if i completely
> understood it. Since there are only 2 nodes how does leader election happen
> because we need odd numbers in order to form a quorum. Please correct me if
> i am understanding it wrong.
>

You need an odd number of total members in the ensemble. If you have an ensemble of 3, then
you can tolerate one crashed server, which means that your quorums have size two. That's why
two servers can elect a leader among them.

In general, if n is the number of servers in the ensemble, then you can tolerate f crashed
servers and the relationship between n and f is n = 2f + 1.

> 2) Is it possible to configure 3 nodes each in DC1 and DC2?
> meaning 1 ensemble consists of 6 nodes with 3 nodes in DC-1 and 3 nodes in
> DC-2
> DC-1 1 Leader 2 Followers
> DC-2  1 Follower 2 Observers.
>
> if DC-1 goes down, will there be a leader election between 3 nodes in DC-2?

No, the two observers won't participate in the election, and the remaining participant in
DC-2 will keep waiting for DC-1 to come back up.

This question about tolerating a DC going down using a second DC is a classic one. If we allowed
DC-2 to elect a leader in the total absence of processes of DC-1, then we would be prone to
split brain scenarios: DC-1 suspects DC-2 and vice-versa, but they are both up. If you want
availability when a DC going down, you need a third DC. Also, keep in mind that availability
here refers to both reads and writes. You can set it up to go into read-only mode.

-Flavio

```
Mime
View raw message