Hi there,
I would like to use zookeeper to implement an election scheme.
There is a recipe on the homepage, but it is relatively complex.
I was wondering what was wrong with the following pseudo code;
forever {
zookeeper.create -e /election <my_ip_address>
if creation succeeded then {
// do the leader thing
} else {
// wait for change in /election using watcher mechanism
}
}
My assumption is that the recipe is more elaborate to the eliminate the
flood of requests if the leader falls away.
But if there are only a handful of leader-candidates ,than that should not
be a problem.
Is this correct, or am I missing out on something.
Thanks,
Eric
|