基于Zookeeper的集群管理器 norbert

openkk 7年前

Norbert是一个基于Zookeeper构建的集群管理器和支持集群的C/S网络API。 norbert封装了zookeeper和netty,使用了协议栈缓存,基于Scala实现。

Norbert is a library which provides easy cluster management and cluster aware client/server networking APIs. Implemented in Scala, Norbert wraps ZooKeeper, Netty and uses Protocol Buffers for transport to make it easy to build a cluster aware application. A Java API is provided and pluggable load balancing strategies are supported with round robin and consistent hash strategies provided out of the box.

示例代码:

public class NorbertClient {    public static void main(String[] args) {      ClusterClient cc = new ZooKeeperClusterClient("norbert", "localhost:2181", 30000); (1)      cc.awaiteConnectionUninterruptibly(); (2)      cc.getNodes(); (3)      cc.addListener(new MyClusterListener()); (4)      cc.markNodeAvailable(1); (5).      cluster.shutdown(6)    }  }

项目主页:http://www.open-open.com/lib/view/home/1339765593856