读书人

Hazelcast引见

发布时间: 2013-10-24 18:27:24 作者: rapoo

Hazelcast介绍
}

?

Hazelcast的官网上面有一个非常直观的视频:http://www.hazelcast.com/screencast.jsp,建议有兴趣的朋友花10分钟时间看看。

还有一份PDF可以参考:http://roma.javaday.it/javaday2010/sites/default/files/ClusteringHazelcast-javaday.pdf。

Hazelcast作为一款与ZooKeeper类似的开源实现,我在网上找了一篇相关的文章:http://blog.armstrongconsulting.com/?p=132 在这篇文章中有一段这样写道:

I had occasional hangs with Hazelcast 1.8.4 which caused me to switch to Zookeeper. As expected, Zookeeper was a lot harder to use than Hazelcast you need Zookeeper installed on 3 servers. There’s no official java client, just some recipes and I found an implementation of Zookeeper locks called Cages on google code. For a java developer, Hazelcast is obviously way easier to use.?

另外,在Hazelcast的官方文档中,提到了Hazelcast的集群机制:

If there is no existing node, then the node will be the first member of the cluster. If multicast is enabled then it will start a multicast listener so that it can respond to incoming join requests. Otherwise it will listen for join request coming via?TCP/IP.

If there is an existing cluster already, then the oldest member in the cluster will receive the join request and check if the request is for the right group. If so, the oldest member in the cluster will start the join process.

In the join process, the oldest member will:

从这点可以看出,虽然Hazelcast没有所谓的“Master”,但是仍然有一个Leader节点(the oldest member),这个概念与ZooKeeper中的Leader类似,但是实现原理却完全不同。同时,Hazelcast中的数据是分布式的,每一个member持有部分数据和相应的backup数据,这点也与ZooKeeper不同。

虽然Hazelcast应用便捷,但是要将其实际应用于生产环境,还是具有一定的风险的,这个需要大量的实际应用来验证。

?

Hazelcast是面向Java的缓存、集群及数据分发解决方案。最近,它的2.0版本发布了。作为新版本的一部分,该产品提供了商用企业版和免费的开源社区版。

其中,社区版在Apache许可2.0下发布,并托管于Google Code中。2.0版本包含了一个分布式备份功能,用以确保每个结点都能均匀地被所有其他结点备份。Hazelcast创始人Talip Ozturk告诉InfoQ说,“我相信我们的备份分发是一个全新的解决方案”。

采用分布式数据备份,结点在丢失时仅会对集群造成很小的影响。这点在内存中有大数据时尤为重要。

Hazelcast解决方案的工作原理是将差不多大小的数据分布到集群中的每个结点上。例如,在一个50个结点的结点集群中,每个结点存储20GB的基本数据以及20GB的备份数据。结点1数据会分成1/49大小的若干份,并由剩余49个结点中的每一个进行备份。如果结点1下线,那么任何迁移都不用就可以让集群保持均衡。随着新节点加入到系统中,Hazelcast会慢慢地将数据迁移到新结点来让所有结点上的数据保持均衡。

新版2.0中的其他特性包括:

读书人网 >开源软件

热点推荐