转自:http://blog.csdn.net/iihero/article/details/7385641
网址: http://www.hazelcast.com/ 。
下边是它的宣传内容:
hazelcast是一个开放源码集群和高度可扩展的数据分发平台,这是为Java:
1. 快如闪电;数以千计的运算/秒。
2. 故障安全;崩溃后没有丢失数据。
3. 作为新服务器的动态调整 。
4. 超级简单的使用 ,包括一个单独的jar。
Hazelcast与各种分布式数据结构,分布式缓存功能,弹性的性质,memcache的支持,与Spring和Hibernate的集成,更重要的是这么多的快乐用户,是功能丰富,企业的准备和开发人员友好的内存数据网格解决方案。
Hazelcast是一个Java的开源分布式内存实现,它具有以下特性:
01 Distributed implementations of java.util.{Queue, Set, List, Map}
02 Distributed implementation of java.util.concurrent.ExecutorService
03 Distributed implementation of java.util.concurrency.locks.Lock
04 Distributed Topic for publish/subscribe messaging
05 Transaction support and J2EE container integration via JCA
06 Distributed listeners and events
07 Support for cluster info and membership events
08 Dynamic HTTP session clustering
09 Dynamic clustering
10 Dynamic scaling to hundreds of servers
11 Dynamic partitioning with backups
12 Dynamic fail-over
13 Super simple to use; include a single jar
14 Super fast; thousands of operations per sec.
15 Super small; less than a MB
16 Super efficient; very nice to CPU and RAM
安装也非常方便:
1 Download hazelcast-version.zip from www.hazelcast.com
2 Unzip hazelcast-version.zip file
3 Add hazelcast.jar file into your classpath
要使用分布式的Map,只需要以下代码即可实现:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import
com.hazelcast.core.Hazelcast;
import
java.util.Map;
import
java.util.Collection;
Map<String, Customer> mapCustomers = Hazelcast.getMap(
"customers"
);
mapCustomers.put(
"1"
,
new
Customer(
"Joe"
,
"Smith"
));
mapCustomers.put(
"2"
,
new
Customer(
"Ali"
,
"Selam"
));
mapCustomers.put(
"3"
,
new
Customer(
"Avi"
,
"Noyan"
));
Collection<Customer> colCustomers = mapCustomers.values();
for
(Customer customer : colCustomers) {
// process customer
}
|
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:
send the new member list to all members
tell members to sync data in order to balance the data load
Every member in the cluster has the same member list in the same order. First member is the oldest member so if the oldest member dies, second member in the list becomes the first member in the list and the new oldest member.
从上边的文字来看,它的这种集群机制是内置的。可以拿来直接使用。
它分好几种版本:
hazelcast企业版
hazelcast企业版(EE)商业授权版的Hazelcast。 它有附加功能,如弹性记忆和安全。
hazelcast弹性记忆
默认情况下,,Hazelcast商店的分布式数据(映射条目,队列中的项目)这是垃圾收集的Java堆。 为您堆变大了,垃圾收集停顿几十秒,严重影响应用程序的性能和响应时间可能会导致您的应用程序。 弹性记忆Hazelcast离堆内存存储,以避免GC暂停。 即使你有TB的内存有大量的更新缓存,GC将有几乎没有影响;导致更多的可预见的延迟和吞吐量。
安全
hazelcast安全性是基于JAAS的可插拔的安全框架,可用于验证群集成员和客户,做客户端操作的访问控制检查。 与安全框架,采取控制谁可以是群集的一部分,或作为客户端和业务允许或不连接。 不要让未经授权的当事方接触群集!
检查出的 安全文件 详细信息。
hazelcast社区版
hazelcast CE是一个开放源码集群和高度可扩展的数据分发平台,为Java。 hazelcast让你轻松跨越群集的份额和分割您的应用程序数据。 hazelcast是一个对等的解决方案(没有主节点,每个节点是一个对),所以不存在单点故障。 JVM的正在运行Hazelcast的动态集群。
hazelcast是纯Java是简单,只要使用java.util中。{队列,地图,集,名单}。 只需添加到你的classpath hazelcast.jar开始编码