centos下Openfire安装+集群+Hazelcast插件+Haproxy
来源:互联网 发布:网络正常守望先锋卡 编辑:程序博客网 时间:2024/06/08 14:49
首先介绍一下在centos下如何安装openfire
1、升级一下yum
#yum update
2、删除系统中自带的JAVA插件
#yum -y remove java*
3、配置java环境
下载jdk-7u79-linux-x64.tar.gz到/tmp/下(路径随意)
进入/tmp/
将jdk-7u79-linux-x64.tar.gz解压到/usr/local/,并改名为jdk
#tar -zxvf jdk-7u79-linux-x64.tar.gz -C /usr/local#mv jdk-7u79-linux-x64 jdk
配置环境变量
#vi /etc/profile
在profile文件末尾加入:
JAVA_HOME=/usr/local/jdkPATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOMEexport PATHexport CLASSPATH
保存退出,使/etc/profile里的配置立即生效
#source /etc/profile
4、下载openfire在linux下的安装包
#wget http://download.igniterealtime.org/openfire/openfire_3_10_2.tar.gz
5、解压
将openfire_3_10_2.tar.gz解压到/usr/local/,并改名为openfire
#tar -zxvf openfire_3_10_2.tar.gz -C /usr/local
解压后/usr/local/下如果直接是openfire则无需重命名
#mv openfire_3_10_2 openfire
6、启动openfire
进入/usr/local/openfire/bin执行如下命令启动openfire
#./openfire start
为你需要的n个主机做同样的步骤
其次介绍如何配置openfire
在配置openfire之前需要配置一下mysql数据库(mysql作为数据库服务器一般单独安装在另外一台主机上)
在MySQL中为openfire创建一个数据库(以用户名root登录,密码admin123456789)
mysql -uroot -padmin123456789
创建的数据库名称叫做”dbopenfire”,然后添加新的用户”test”并且密码设置为”123456”
mysql> CREATE DATABASE dbopenfire CHARACTER SET='utf8';mysql> CREATE USER 'test'@'%' IDENTIFIED BY '123456';mysql> GRANT ALL ON dbopenfire.* TO 'test'@'%';mysql> FLUSH PRIVILEGES;mysql> quit
创建好数据库之后开始对n个openfire进行同样的配置
openfire设置
openfire配置登录: http ://openfire服务器地址:9090/
首先进行语言配置
其次进行服务器设置
这里域统一设置为ubuntu(可以随意设置,但是所有的openfire必须一致,而且在用户登录时,username@host中的host就是这个域)
再进行数据库设置-标准连接
所有的openfire必须设置为同样的数据库。(这一步非常重要)
接下来选择初始设置
最后配置一下服务器的登录密码,默认用户名admin
(注意,因为所有的openfire服务器共享一个数据库,所有所有的openfire服务器的登录用户名和密码都一样)
为所有的openfire服务器进行上述设置
基本配置完成以后就开始进行集群配置
1、关闭openfire集群上的所有服务器
进入openfire的安装目录 /usr/local/openfire
执行如下命令
./bin/openfire stop
2、每台服务器都应该做如下操作
进入openfire的安装目录 /usr/local/openfire/plugins
a) 删除已有插件hazelcast.jar和broadcast.jarb) 删除插件目录 plugins/hazelcasr和plugins/broadcastc) 将新的hazelcasr.jar和broadcast.jar插件复制到 plugins目录
3、在集群的其他插件重复2的操作
4、重启集群中的所有openfire服务器
切换到
/usr/local/openfire
执行
./bin/openfire start
重启之后登录网页管理页面在插件中就可以看到安装好的hazelcasr和broadcast插件
5、插件管理
进入服务器管理中的集群
进入集群管理,在集群设置启用集群
启用之后就可看到集群了
6、集群配置
注意事项
hazelcast最新版3.5.2的配置有重要修改
官方给出的
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.
通过组播自动发现机制,hazelcast允许集群成员自动发现而不需要知道准确的地址。
通过这个机制,无需在对< tcp-ip>进行配置
<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>
集群如下
配置如下(openfire/plugins/hazelcast/classes/hazelcast-cache-config.xml)
<join> <multicast enabled="false"> </multicast> <tcp-ip enabled="true"> <member>172.16.181.73:5701</member> <member>172.16.181.77:5701</member> </tcp-ip> <aws enabled="false"/> </join>
如果按照之前版本的配置里面< tcp-ip>中的节点是< hostname>则会报错,服务器日志为:
org.jivesoftware.openfire.plugin.util.cache.ClusteredCacheFactory - Unable to start clustering - continuing in local modecom.hazelcast.config.InvalidConfigurationException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'hostname'. One of '{"http://www.hazelcast.com/schema/config":required-member, "http://www.hazelcast.com/schema/config":member, "http://www.hazelcast.com/schema/config":interface, "http://www.hazelcast.com/schema/config":members, "http://www.hazelcast.com/schema/config":member-list}' is expected.
7、负载均衡(Haproxy配置在centos上)
安装 Haproxy
yum install haproxy
配置 Haproxy
vi /etc/haproxy/haproxy.cfg
添加如下内容
listen openfirexmpp :15222 mode tcp option log-health-checks option redispatch option tcplog balance roundrobin server p1 172.16.181.73:5222 check server p2 172.16.181.77:5222 checklisten xmpp-openfirexmpp23 :15223 mode tcp option log-health-checks option redispatch option tcplog balance roundrobin server p1 172.16.181.73:5223 check server p2 172.16.181.77:5223 checklisten openfirehttp :17070 mode tcp option log-health-checks option redispatch option tcplog balance roundrobin server p1 172.16.181.73:7070 check server p2 172.16.181.77:7070 checklisten xmpp-7443 :17443 mode tcp option log-health-checks option redispatch option tcplog balance roundrobin server p1 172.16.181.73:7443 check server p2 172.16.181.77:7443 checklisten openfireadmin :19090 mode tcp option log-health-checks option redispatch option tcplog balance roundrobin server p1 172.16.181.73:9090 check server p2 172.16.181.77:9090 check
重启haproxy
service haproxy restart
测试
成功登陆
- centos下Openfire安装+集群+Hazelcast插件+Haproxy
- centos7下Openfire安装+集群+Hazelcast插件+Haproxy
- openfire Hazelcast插件集群配置
- OPENFIRE 使用Hazelcast插件进行集群
- openfire 使用hazelcast插件实现集群配置
- Openfire Hazelcast集群详解
- Openfire Hazelcast集群详解
- centos 7 下安装haproxy
- Centos下Openfire详细安装过程
- openfire在centos下的安装
- Linux centOS下安装配置openfire
- Centos下安装zookeeper集群
- centOS 下redis 集群安装
- CentOS下安装Redis3集群
- openfire集群安装
- centos下安装openfire以及mySQL配置(默认安装)
- openfire centos 上安装
- centos安装openfire
- 广告英文术语大全
- Android 百度地图(二)——地图切换、定位、添加覆盖物、搜索位置、连线
- optical_flow_evaluation
- $.each工具函数
- Mac下显示/隐藏文件夹
- centos下Openfire安装+集群+Hazelcast插件+Haproxy
- 慢慢数据抓取路,从BeautifulSoup走起
- iOS求职之OC面试题
- 【Balkan2002】【BZOJ1336】Alien最小圆覆盖
- XML文本转为MAP对象的简便方法(利用jackson-dataformat-xml)
- Streaming Media
- hive 1.0.1 安装配置 hadoop 2.6.0
- 关于springMVC访问静态文件404
- iOS极光推送-具体步骤