基於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. 登陸客戶端

     

相關文章
相關標籤/搜索