The idea (in the leader election scenario) for zookeeper is for you to be able to coordinate a service in a distributed environment.
Consider the case where you have a service that takes all phones from the DB and send a message to every one of them. and you have that service running in 5 servers.. withour coordination each client will recieve 5 message, that is not what you need. Zookeeper is a possible solution to that... At the begining the service creates a zookeeper instance and offers itself as leader.. if (leader) then process() if not wait to be leader Why is this helpful.. bezides coordination, to avoid havinf 2 servers running the same process it also solves the problem "what if this server or service is down?".. cause zookeeper will take care of changing the leadership. In this case a zookeeper node cam be used to track the last sent message so the next leader (in case is needede) can continue from the last sent message If you what to know how the leader election "protocol" is being implemented or how to use it refer the link i sent you and the recipe classes .. it should well documentd there Regards On Wed, Aug 13, 2014 at 1:23 PM, mufc_fan <[email protected]> wrote: > Thank you Alvaro for response...Now what i want to know whether I want to > code receipes in java or C whatever...Also can u tell me why zookeeper is > needed...I know it is to co-ordinate service but how... can u tell me with > a > simple example..plz I am waiting for ur response > > > > -- > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/Leader-election-in-zookeeper-tp7580147p7580150.html > Sent from the zookeeper-user mailing list archive at Nabble.com. > -- Ing. Alvaro Gareppe [email protected]
