基于XMPP的即时通讯系统的创建(五)— openfire

现决定使用Openfire做为服务端,Openfire采用Java开发,基于XMPP的实时开源协做服务器。单台可支持上万并发用户。java

Openfire体系结构

Openfire体系由其提供的服务器端、客户端以及相应的开发库组成。mysql

 

Openfire

一般咱们所说的Openfire就是指Openfire服务端,如今已经更新到3.10.3版本,该服务器实现了绝大部分的XMPP协议。linux

除此以外,还有大量的Openfire插件可供使用。sql

Spark

Spark是一个使用java开发的实时协做客户端,经过简单的配置和注册便可使用。数据库

Smack

Smack is a client library. You can use it to log into an XMPP domain and make use of the functionality it provides. Typically, Smack is used to implement an instant messaging client。服务器

Tinder

Tinder is a low-level XMPP library. It provides Java implementations of basic XMPP entities, such as Stanzas (called 'Packet' in XMPP), JIDs and Components (which typically implement part of the functionality of an XMPP server). Although in theory, Tinder could be used to implement client functionality, it currently is primarily used on the server-side. Both Whack and Openfire (an XMPP server implementation) use Tinder-defined entities. Smack does not use Tinder at all.网络

Whack

Whack is Java library that is used to implement external components. Whack allows a Component (as defined in Tinder) to run as a stand-alone process. Whack allows you to connect this process to an XMPP domain. This way, you can extend the functionality provided by that domain without modifying the implementation of the server software.并发

服务端搭建

安装数据库

Ÿ   1. 安装客户端dom

  rmp –ivh MySQL-client-5.6.21-1.linux_glibc2.5.x86_64.rpmjsp

  (注)若是提示冲突,须要运行yum –y remove ${APP}卸载冲突软件

Ÿ   2. 安装服务端

  rmp –ivh MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm

Ÿ   3. 数据库配置

  3.1设置本地登陆帐号

    mysql –u root -p

    set password for root@localhost=password('jiyq');

    若是主机名其余,例如jiyq,须要将localhost改成jiyq

    set password for root@jiyq=password('jiyq');

  3.2切换数据库

    use mysql;

  3.3设置网络链接帐户

    Grant all privileges on *.* to 'root'@'%' identified by 'jiyq' with grant option;

  3.4 更新帐户权限

    FLUSH PRIVILEGES; 

  3.5 打开防火墙3306端口

    iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

    iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT

    service iptables save

  3.7 建立数据库

    create database openfire

  3.8 运行建表语句

    在openfire数据库下,运行/opt/openfire/resources/database/openfire_mysql.sql

安装服务端

Ÿ   1. 解压openfire_3_10_3.zip到/opt目录下

Ÿ   2. 启动openfire

  /opt/openfire/bin

  ./openfire start

Ÿ   3. 访问配置页面

  http://192.168.189.131:9090/setup/index.jsp

Ÿ   4. 配置语言

   

Ÿ   5. 服务器设置

   

Ÿ   6. 数据库设置

   

Ÿ   7. 数据库设置-标准链接

   

Ÿ   8. 特性设置

   

Ÿ   9. 管理员帐户

   

Ÿ   8. 安装完成

   

客户端搭建

这里使用Spark做为PC端的客户端。

  1. 安装Spark

    这里采用spark_2_7_3_online.exe版本

  2. 注册用户

     

  3. 登陆客户端

     

相关文章
相关标签/搜索