Senthil
Senthil

Reputation: 51

Master election with respect to Zookeeper and its clients

I am having difficultly in understanding how the leader , follower mechanism works , lets say i am building a distributed application with 2 master node , 6 slave nodes and 3 zookeeper node with one zookeeper node being a leader and among 2 master node 1 being active and connected to zookeeper leader.

My questions here are

  1. Does my master nodes are called as master just because its connected zookeeper leader , (i.e) My node called as master since its Znode connected to Zookeeper leader ?

  2. Does a leader election mechanism happens when a leader zookeeper node dies ? and how it will impact our master , does our master would be connected to the newly elected leader ?

  3. If our application's master node dies ,does the standby master node would be notified if it listens to master's znode , if so is it enough for our standby node has ephemeral sequential node or any other thing we need to do to make it as a master node active?

  4. Zookeeper documentations are saying that writes are happening through only leader and it broadcasts to other follower nodes and reads are serviced directly from follower nodes . Is this has any relation with read and write design i do with my application (i.e) i have intention to design that my writes has to be happened through my master and reads are through my slaves , zookeeper's broadcasting ability has to do anything with it ? or the zookeeper's writes are completely different from the application's write.

Sorry if i asked anything doesn't make sense , please help me to understand. Any resources which explains these would be very helpful for me.

Upvotes: 0

Views: 816

Answers (1)

sel-fish
sel-fish

Reputation: 4476

Assumed that you are using Curator to elect master.I will explain the process of master election of Curator Recipe, then you may figure out all your questions.

  • Master Election use two features of ZooKeeper, ephemeral node and sequential node
  • The app node which got the least number will be elected as master and the session will become the ephemeral owner
  • After your master app node dies, ZooKeeper will delete and noticed all the node which are watching that znode

Upvotes: 0

Related Questions