基于Zookeeper的集群管理器 norbert
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) } }
本文由用户 openkk 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!