-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathREADME
34 lines (22 loc) · 1.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Author: Alan Perez-Rathke ([email protected])
This is a simple implementation of the ZooKeeper leader election algorithm as outlined here:
http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection
Classes:
*ZooElectableClient:
- An abstract ZooKeeper client that implements the leader election algorithm.
- The method performRole() must be implemented in a child class. This function is intended to
contain the work that the client node must actually perform (conditioned on whether or not it
is the leader).
*ZooTestElectableClient:
- A simple demo ZooKeeper client that simply outputs its state after any leader election.
*ZooZNodeDeletionMonitor: Based on http://zookeeper.apache.org/doc/current/javaExample.html#ch_Introduction
- A monitor that watches for znode deletion and informs its listener when this occurs
Scripts (*nix):
./build.sh - will compile the java sources
./run.sh - will run an instance of the test client
Usage:
The clients assume that a server is running in the background. See:
http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
for documentation on downloading and starting a ZooKeeper server. To demo, run multiple
client instances (each in separate terminal windows), then kill the leader instance to
observe a new leader election.