A simple cluster management system for partitioned data. E.g. a distributed search engine.
Zu is built on top of Twitter's Zookeeper based server management api called ServerSets.
Zu comes from the Chinese character: 组, which means a group or a set.
- Simple api
- Manages partitioned data
- Integration with Twitter's Finagle
mvn clean package
2 artifacts:
- zu-core - core library
- zu-finagle - Finagle support
<groupid>com.senseidb.zu</groupid>
<artifactId>zu-core</artifactId>
<groupid>com.senseidb.zu</groupid>
<artifactId>zu-finagle</artifactId>
// Zookeepr location
String zkHost = ...
int zkPort = ...
// implementation provides a mapping between a url and its partitions
PartitionInfoReader partitionInfoReader = ...
ZuCluster cluster = new ZuCluster(new InetSocketAddress(zkHost,zkPort), partitionInfoReader, "mycluster");
cluster.addClusterEventListener(new ZuClusterEventListener() {
@Override
public void clusterChanged(Map<Integer, ArrayList<InetSocketAddress>> clusterView) {
System.out.println("cluster changed");
}
@Override
public void nodesRemovedFromCluster(List<InetSocketAddress> nodes) {
System.out.println("nodes removed from cluster");
}
});
// join a cluster
EndPointStatus endpoint = cluster.join(new InetSocketAddress(host,port));
// leaving a cluster
cluster.leave(endpoint);
Need more, check out the unit tests:
Simple cluster setup: Example 1.
A full finagle based http cluster of servers: Example 2.