0

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.

Senthil
  • 11
  • 1
  • 4

1 Answers1

0

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
sel-fish
  • 4,308
  • 2
  • 20
  • 39
  • Thanks for the response @sel-fish, i guess zookeeper ensemble also following the same leader follower mechanism . If not is there any other way it selects its leader . Basically i want to know the difference between the leader election process among the zookeeper ensemble nodes and the client applications which depends oon zookeeper ensemble for its master, slave mechanism (like Hbase master and region servers) – Senthil Apr 30 '19 at 11:38