openfire Hazelcast插件集群配置
原文:http://blog.csdn.net/frankcheng5143/article/details/48708899
注意虽然hazelcast 官方已经有了3.5.2版本,但是openfire的hazelcast插件最新版却不是3.5.2,如果需要在openfire中使用hazelcast的最新版,请前往http://www.igniterealtime.org/projects/openfire/plugins.jsp下载 
本人撰写本文的时候openfire的hazelcast插件最新版为2.1.2,2015年9月16号更新,已经是最新版本了。
Hazelcast Clusters集群配置
主要有以下三种方式
第一种、Discovering Members by Multicast(通过组播自动发现节点)
With the multicast auto-discovery mechanism, Hazelcast allows cluster members to find each other using multicast communication. The cluster members do not need to know the concrete addresses of the other members, they just multicast to all the other members for listening. It depends on your environment if multicast is possible or allowed.
官方给的示例
<network>
    <join>
        <multicast enabled="true">
            <multicast-group>224.2.2.3</multicast-group>
            <multicast-port>54327</multicast-port>
            <multicast-time-to-live>32</multicast-time-to-live>
            <multicast-timeout-seconds>2</multicast-timeout-seconds>
            <trusted-interfaces>
               <interface>192.168.1.102</interface>
            </trusted-interfaces>
        </multicast>
        <tcp-ip enabled="false">
        </tcp-ip>
        <aws enabled="false">
        </aws>
    </join>
<network>
这个配置并不全面,实际工作配置中,< network>标签中还有其它子标签,而官方给的< join>标签是一个完整的配置,所以如果采用这种配置,请直接拷贝< join>标签。
如果需要使用multicast
首先,设置multicast标签为true
其次,设置multicast-group, multicast-port, multicast-time-to-live,等标签(实际工作中只设置了multicast-group和multicast-port标签,我使用的版本为2.1.2)
最后,设置tcp-ip和aws标签为false
我的配置如下(openfire hazelcast 2.1.2)
 <join>
        <multicast enabled="true">
            <multicast-group>224.2.2.3</multicast-group>
            <multicast-port>54327</multicast-port>
        </multicast>
        <tcp-ip enabled="false"/>
        <aws enabled="false"/>
 </join>
官方解释
multicast element
The multicast element includes parameters to fine tune the multicast join mechanism.
- enabled: Specifies whether the multicast discovery is enabled or not, true or false.
 - multicast-group: The multicast group IP address. Specify it when you want to create clusters within the same network. Values can be between 224.0.0.0 and 239.255.255.255. Default value is 224.2.2.3.
 - multicast-port: The multicast socket port that the Hazelcast member listens to and sends discovery messages through. Default value is 54327.
 - multicast-time-to-live: Time-to-live value for multicast packets sent out to control the scope of multicasts. See more information here.
 - multicast-timeout-seconds: Only when the nodes are starting up, this timeout (in seconds) specifies the period during which a node waits for a multicast response from another node. For example, if you set it as 60 seconds, each node will wait for 60 seconds until a leader node is selected. Its default value is 2 seconds.
 - trusted-interfaces: Includes IP addresses of trusted members. When a node wants to join to the cluster, its join request will be rejected if it is not a trusted member. You can give an IP addresses range using the wildcard () on the last digit of IP address (e.g. 192.168.1. or 192.168.1.100-110).
 
下面解释一下< multicast>这个标签
- enabled: 设置是否启用multicast自动发现机制取值为true或false.
 - multicast-group: multicast组播ip地址.设置该属性为在同一个局域网里做集群的时候用。取值范围为224.0.0.0 到 239.255.255.255之间,默认值为224.2.2.3
 - multicast-port:multicast 套接字端口作为Hazelcast节点监听和发送消息使用,默认端口号54327
 - multicast-time-to-live: Time-to-live 用来设置multicast包的生存时间(和路由器的差不多)
 - multicast-timeout-seconds: 只有当节点启动的时候,用来设置节点等待multicast从另一个节点的响应时间。举例来说,如果设置该值为60s,每个节点都回等待60s直到一个主节点被选举出,默认值为2s(该值不宜太大,也不应太小)
 - trusted-interfaces: 将信任的IP地址包含进来。当一个节点想要加入集群的时候如果它不在被信任节点中,它的加入请求会被拒绝,可以设置一个IP地址段(如192.168.1.* or 192.168.1.100-110)
 
第二种、Discovering Members by TCP(通过组TCP发现节点)
If multicast is not the preferred way of discovery for your environment, then you can configure Hazelcast to be a full TCP/IP cluster. When you configure Hazelcast to discover members by TCP/IP, you must list all or a subset of the members’ hostnames and/or IP addresses as cluster members. You do not have to list all of these cluster members, but at least one of the listed members has to be active in the cluster when a new member joins.
官方给的示例
<network>
    ...
    <join>
        <multicast enabled="false">
        </multicast>
        <tcp-ip enabled="true">
            <member>machine1</member>
            <member>machine2</member>
            <member>machine3:5799</member>
            <member>192.168.1.0-7</member>
            <member>192.168.1.21</member>
        </tcp-ip>
        ...
    </join>
    ...
</network>
如果需要使用TCP
首先,设置multicast和aws标签为false
其次,设置tcp-ip标签为ture
最后,使用member标签将节点添加到tcp-ip中(注意:很早以前的版本使用的是标签式hostname)
官方解释
The tcp-ip element includes parameters to fine tune the TCP/IP join mechanism.
- enabled: Specifies whether the TCP/IP discovery is enabled or not. Values can be true or false.
 - required-member: IP address of the required member. Cluster will only formed if the member with this IP address is found.
 - member: IP address(es) of one or more well known members. Once members are connected to these well known ones, all member addresses will be communicated with each other. You can also give comma separated IP addresses using the members element.
 
下面解释一下tcp-ip 
tcp-ip标签使用以下标签来设置使用TCP/IP 做集群的加入机制
- enabled: 使TCP/IP生效,取值为true或false
 - required-members: 节点的IP地址范围
 - member:IP地址,需要一个一个添加
 
如果不提供端口,Hazelcast会自动尝试使用5701,5702等等,从5701递增
我的配置如下(openfire hazelcast 2.1.2)
<join>
    <multicast enabled="false">
        <multicast-group>224.2.2.3</multicast-group>
        <multicast-port>54327</multicast-port>
    </multicast>
    <tcp-ip enabled="true">
        <member>172.16.181.73:5701</member>
        <member>172.16.181.74:5701</member>
        <member>172.16.181.75:5701</member>
        <member>172.16.181.76:5701</member>
    </tcp-ip>
    <aws enabled="false"/>
</join>
除了使用上述配置还可以使用地址区间配置如下(注意,members中配置至少两个)
<join>
    <multicast enabled="false">
    </multicast>
    <tcp-ip enabled="true">
        <members>172.16.181.73-75,172.16.181.76</members>
    </tcp-ip>
    <aws enabled="false"/>
</join>												
											openfire Hazelcast插件集群配置的更多相关文章
- 即时通信系统Openfire分析之七:集群配置
		
前言 写这章之前,我犹豫了一会.在这个时候提集群,从章节安排上来讲,是否合适?但想到上一章<路由表>的相关内容,应该不至于太突兀.既然这样,那就撸起袖子干吧. Openfire的单机并发量 ...
 - 浅析Quartz的集群配置
		
浅析Quartz的集群配置(一) 收藏人:Rozdy 2015-01-13 | 阅:1 转:22 | 来源 | 分享 1 基本信息 摘要:Quar ...
 - (转)Apache+Tomcat集群配置
		
本文Apache+Tomcat集群配置 基于最新的Apache和Tomcat,具体是2011年4月20日最新的Tomcat和Apache集群和负载均衡配置. 准备环境 Apache Apache是ht ...
 - rabibtMQ安装及集群配置-linux
		
安装RabbitMQ RabbitMQ是流行的开源消息队列系统,用erlang语言开发,故首先需要安装erlang依赖及erlang. 安装erlang依赖的基本环境,通过yum方式进行安装: yum ...
 - Apache+Tomcat服务器集群配置
		
在实际应用中,如果网站的访问量很大,为了提高访问速度,可以与多个Tomcat服务器与Apache服务器集成,让他们共同运行servlet/jsp 组件的任务,多个Tomcat服务器构成了一个集群(Cl ...
 - ES2:ElasticSearch 集群配置
		
ElasticSearch共有两个配置文件,都位于config目录下,分别是elasticsearch.yml和logging.yml,其中,elasticsearch.yml 用来配置Elastic ...
 - 安装rabbitmq以及集群配置
		
前言: (一些有用没用的唠叨,反正看了也不少肉,跳过也没啥) 情况是这样的:虚拟机.CentOS 6.5.免编译包安装rabbitmq集群,可不用连外网. 我原计划是安装在虚拟机上wyt1/wyt2/ ...
 - 『集群』002 Slithice 集群配置工具 的使用
		
Slithice 集群配置工具 的使用 Slithice集群配置工具 主界面 在测试 Slithice 的 Demo 中,我配置了 7个服务端: 一个 WCF 的 中央服务端: 两个 WCF 的 成员 ...
 - 使用apache和nginx代理实现tomcat负载均衡及集群配置详解
		
实验环境: 1.nginx的代理功能 nginx proxy: eth0: 192.168.8.48 vmnet2 eth1: 192.168.10.10 tomcat server1: vmnet2 ...
 
随机推荐
- promise应用于ajax
			
promise应用于ajax,可以在本页打开控制台,复制代码试验 var url = 'https://www.cnblogs.com/mvc/blog/news.aspx?blogApp=dkplu ...
 - [实战]MVC5+EF6+MySql企业网盘实战(10)——新建文件夹
			
写在前面 上篇文章更新了编辑了文件名的操作,本片文章将实现新建文件夹的功能. 系列文章 [EF]vs15+ef6+mysql code first方式 [实战]MVC5+EF6+MySql企业网盘实战 ...
 - 深入理解JS各种this指向问题
			
说到this,入前端坑的人都知道这是JS初期语言毕竟之路.很多人(我就是)对于this的了解很模糊,或者不够全面.最近打算在反过来在看下es6,在es6中又出现了箭头函数对于this的理解有多了层认识 ...
 - Cookie机制和Session机制
			
1. cookie 1. Cookie 是在HTTP协议下,服务器或脚本可以维护客户工作站上信息的一种方式.Cookie 是由 Web服务器保存在用户浏览器(客户端)上的小文本文件(内容通常经过加密) ...
 - spring_150904_hibernatetemplate
			
实体类: package com.spring.model; import javax.persistence.Entity; import javax.persistence.Id; import ...
 - phantomjs2.1 初体验
			
上次看了一下scrapy1.1的新手指南 决定写个小爬虫实验一下 目标网站是http://www.dm5.com/manhua-huofengliaoyuan准备爬取漫画火凤燎原的已有章节,将图片保存 ...
 - 长沙理工大学第十二届ACM大赛-重现赛 G - 跑路ing
			
题目描述 vigoss18 辞职成功终于逃出了公司,但是没过太久,公司就发现vigoss18 的所作所为,于是派人来把他抓 回去. vigoss18 必须一直跑路,躲避公司的围捕.可以抽象的看成一个有 ...
 - BNUOJ 52511 Keep In Line
			
队列,$map$. 每次出队进行出队操作的是时候,先把队列中需要出队的人全部出队,然后比较对头和当前出队的人是否相同. #include<bits/stdc++.h> using name ...
 - BZOJ4327 [JSOI2012] 玄武密码 [AC自动机]
			
题目传送门 玄武密码 Description 在美丽的玄武湖畔,鸡鸣寺边,鸡笼山前,有一块富饶而秀美的土地,人们唤作进香河.相传一日,一缕紫气从天而至,只一瞬间便消失在了进香河中.老人们说,这是玄武神 ...
 - innerText和innerHTML, outerHTML
			
js中 innerHTML与innerText的用法与区别及解决Firefox不支持Js的InnerHtml问题 用法: <div id="test"> <spa ...