`
gallop_liu
  • 浏览: 107695 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

openfire3.9.1集群配置

阅读更多

 

一:准备软件:

1.CentOS-6.5-x86_64位服务器2台(虚拟机)

2.jdk-7u55-linux-x64.gz

3.openfire_3_9_1.tar.gz

 

二: 安装CentOS-6.5-x86_64位服务器配置如下

 

编号

Ip地址

用途

备注

openfireS01

192.168.78.214

Openfire服务

 

openfireS02

192.168.78.215

Openfire服务

 

Mysql数据库

192.168.78.213

Mysql数据库

 

 

三:服务器安装完毕后配置:

1、配置静态ip:

[root@openfireS01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

------------------------------------------

修改为:

DEVICE=eth0

HWADDR=00:0C:29:52:36:B6

TYPE=Ethernet

UUID=353d2aad-7fd1-478f-9f8a-42ccf53ab837

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

IPADDR=192.168.78.214

PREFIX=24

GATEWAY=192.168.78.129

DNS1=8.8.8.8

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

 

2、重启网卡:

[root@openfireS01 ~]# service network restart 或 # /etc/init.d/network restart

相应的,另一台服务器配置ip为:192.168.78.215

3、临时关闭防火墙

[root@localhost ~]# service iptables stop

永久关闭防火墙[root@localhost ~]# chkconfig iptables off  

4、将来可以编辑防火墙开启下面端口:

 

端口号

用途

备注

3306

mysql的默认连接端口

 

9090

openfire的默认管理端口

 

5701

该端口是openfire下的broadcast插件集群广播通知所使用的端口

 

22

系统远程管理端口

 

 

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 9090 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 5701 -j ACCEPT

[root@localhost ~]# /etc/rc.d/init.d/iptables save

[root@localhost ~]# chkconfig iptables on

[root@localhost ~]# service iptables start

[root@localhost ~]# service iptables restart

[root@localhost ~]# vi /etc/sysconfig/iptables

 

5、用vi编辑器打开/etc/sysconfig/network文件,里面有一行 HOSTNAME=localhost.localdomain (如果是默认的话),修改 localhost.localdomain 为你的主机名,修改为如下:

[root@openfireS01 ~]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=openfireS01

相应的,另一台服务器的主机名改为如下:

[root@openfireS02 ~]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=openfireS02

 

6、用vi编辑器修改/etc/hosts文件,修改为:

[root@openfireS01 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.78.214 openfireS01

192.168.78.215 openfireS02

 

 

(两台服务器都要配置,重启后,主机名修改即可生效)

 

 四:安装Jdk并配置环境:

1:安装jdk-7u51

[root@openfireS01 local]# tar xzvf jdk-7u55-linux-x64.gz

2:配置环境变量

修改vi /etc/profile文件,在末尾添加:

export JAVA_HOME=/usr/local/jdk1.7.0_55

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar

export PATH=$PATH:$JAVA_HOME/bin

 

3使配置文件立即生效:

[root@localhost ~]# source /etc/profile

 

4测试安装:

在shell控制台输入“java -version” 如果显示java_1.7.0.25则表示配置成功。

(如下图)



 

五:安装mysql

mysql已经在192.168.78.213上有安装,此处省略安装步骤

1、导入openfie初始数据库(数据库脚本在openfire/resources/database/openfire_mysql.sql)

地址

127.0.0.1

192.168.78.213

数据库名

myopenfire

账户

root

密码

starNet67*21

允许访问的ip

127.0.0.1

192.168.78.214

192.168.78.215


六:安装openfire

1、安装

[root@openfireS01 softinit]# cp openfire_3_9_1.tar.gz  /opt

[root@openfireS01 softinit]# cd /opt

[root@openfireS01 opt]# ll

total 9368

-rwxr-xr-x. 1 root root 9591518 Apr 16 17:22 openfire_3_9_1.tar.gz

[root@openfireS01 opt]# tar xzvf openfire_3_9_1.tar.gz

 

2、启动openfire

[root@openfireS01 bin]# cd /opt/openfire/bin

[root@openfireS01 bin]# ./openfire start

 

 

3、用浏览器访问http://192.168.78.214:9090 进行初始化配置(如果无法访问,需要先把防火墙关闭)

使用http://ip:9090 配置,选择安装语言、设置好域名称(注意,这里的集群名字所有的节点必须一致!)、选择数据库连接地址、设置openfire后台密码

 

次序

主机

网页地址

数据库连接设置

1

openfireS01

http://192.168.78.214:9090/

jdbc:mysql://192.168.78.213:3306/myopenfire

2

openfireS02

http://192.168.78.215:9090/

jdbc:mysql://192.168.78.213:3306/myopenfire

 



 

 选择中文

 



 

 (注意,这里的集群名字所有的节点必须一致!

 



 

 如果是集群配置必须选择标准数据库

 



 

 配置你的mysql服务

 



 

 



 

 配置管理账号,如果有可以直接跳过,集群配置只需要配置一个账号就行了,其他节点配置直接跳过这一步。如果一切没问题你就应该用你的管理员账号登录了,

其他节点配置也类似

 



 

 4、所有节点的配置都完成了之后接下来就是安装集群插件了,每个节点安装openfire插件都是一样的,进入http://192.168.78.214:9090



 

 



 

 



 5、修改hazelcast插件的配置文件

每个节点都编辑/opt/openfire/plugins/hazelcast/classes/hazelcast-cache-config.xml 文件

openfireS01 修改如下:

<join>

            <multicast enabled="false"/>

            <tcp-ip enabled="true">

                <hostname>openfireS01:5701</hostname>

                <hostname>openfireS02:5701</hostname>

            </tcp-ip>

            <aws enabled="false"/>

        </join>

        <interfaces enabled="true"/>

            <interface>openfireS01<interface>

        </interfaces>

 

 

openfireS02 修改如下:

<network>

        <port auto-increment="true">5701</port>

        <join>

            <multicast enabled="false"/>

            <tcp-ip enabled="true">

                <hostname>openfireS01:5701</hostname>

                <hostname>openfireS02:5701</hostname>

            </tcp-ip>

            <aws enabled="false"/>

        </join>

        <interfaces enabled="true"/>

            <interface>openfireS02<interface>

        </interfaces>

6、重启openfireS01 和 openfireS02的openfire的服务。

登陆后台选择“服务器管理器”-> "Clustering",将“Clustering Enabled ”设置成“Enable",注意这个过程很缓慢,多等会。

注意:当我们点了Enable之后,这个集群端口5701才会开放

 



 

 如果一切正常,即可看到各个集群的节点:

 



 

七:集群测试

1、将多个spark客户端登录到A、B两台机器中的一台,验证在同一服务器上的客户端的通信、不在同一服务器的客户端的通信是否都正常,如果正常说明集群配置成功。

2、我们在Openfire管理控制台中添加的test用户登录:



 

3、用spark 进行登入:


 

4、添加好友,并进行消息测试:

 


 



 

 

 

  • 大小: 5.7 KB
  • 大小: 22.3 KB
  • 大小: 11.3 KB
  • 大小: 12.3 KB
  • 大小: 31.3 KB
  • 大小: 17.3 KB
  • 大小: 15.1 KB
  • 大小: 5.8 KB
  • 大小: 17.2 KB
  • 大小: 64.5 KB
  • 大小: 26.3 KB
  • 大小: 26.5 KB
  • 大小: 35.9 KB
  • 大小: 15.7 KB
  • 大小: 71.2 KB
  • 大小: 28.3 KB
  • 大小: 26.6 KB
分享到:
评论
3 楼 sherryEin 2014-09-11  
插件部署完后,两台服务器中都会出现两个节点,但节点A中都正常显示,节点B中对于A节点的显示内存等内容为N/A。
B节点显示:
Nodes     Joined            Clients     Incoming Servers  Outgoing Servers  Memory   
  A   2014-9-11 10:57:20    N/A                 N/A                               N/A                    N/A   
  B   2014-9-11 10:57:14  1 (100%)       0 (0%)                        0 (0%)            135.36 MB of 273.75 MB used

A节点中都可正常显示。后来不停刷新控制台,有时正常显示,有时不能正常显示。
2 楼 kaixinwoo 2014-04-30  
cluster就是只能看到自己的节点,无语了,求解释。
1 楼 kaixinwoo 2014-04-30  
按照你的做法做了,等了一个小时,进群就是没建立起来

相关推荐

Global site tag (gtag.js) - Google Analytics