如何集成Tigase 8.x与MongoDB?

XMPP

1 基础知识

1.1 Tigase支持的数据库

Database

Recommended
Version

Minimum Version

Additional
Information

DerbyDB

10.12.1.1

10.12.1.1

Included with Tigase
XMPP Server

MySQL

5.7

5.6.4

Required to properly support timestamp
storage with millisecond precision

SQLServer

2014

2012

2012 needed so we can count use
fetch-offset pagination feature.

PostgreSQL

9.5

9.4

New UA schema requires at least 9.4

MongoDB

3.2

3.0

MariaDB

?

10.0.12

Basic features works with
10.0.12-MariaDB Homebrew, but is not fully tested.

1.2 Tigase集成数据的的条件

– 合适的Java MongoDB驱动(即/usr/tigase/jars/tigase-mongodb.jar)
– 数据库分配具有root权限的用户

2 最佳实践

2.1 环境部署

2.1.1 部署Tigase

如果你尚未部署Tigase 8.x,请参阅以下章节部署,

如何部署Tigase Server 8.x?

2.1.2 部署MongoDB

如果你尚未部署Tigase所需的MongoDB,请参阅以下章节部署,

如何部署MongoDB数据库(YUM)?

2.2 配置Tigase

2.2.1 准备Tigase所需的数据(可选)

mongo

使用如下命令完成数据库认证,

use admin
db.auth("root","rootpwd")

使用如下命令创建应用所需的数据库权限,

use tigasedb
db.createUser(
     {
       user:"tigase",
       pwd:"tigasepwd",
       roles:[{role:"dbOwner",db:"tigase"}]
     }
  )
quit()

2.2.2 运行配置向导

http://cmdschool.org:8080/

由于以上是界面操作,详细步骤省略,参数填写可参考如下信息,

company name: cmdschool.org
Configuration type: Default installation
Your XMPP (Jabber) default domain: cmdschool.org
Server administrators: admin@cmdschool.org
Admin password: adminpwd
Select database: MongoDb
Name of the database: tigasedb
Address of the database: localhost
Name of the user: tigase
Password of the user: tigasepwd
Database root account username: root
Database root account password: rootpwd
User Name of Security: admin
Password of Security: adminpwd

最终生成的配置文件可通过如下命令查询,

cat /etc/tigase/config.tdsl

详细配置如下,

admins = [
    'admin@cmdschool.org'
]
'config-type' = 'default'
debug = [ 'server' ]
'default-virtual-host' = 'cmdschool.org'
dataSource () {
    default () {
        uri = 'mongodb://tigase:tigasepwd@localhost/tigasedb'
    }
}
http () {
    setup () {
        'admin-password' = 'tigasepwd'
        'admin-user' = 'tigase'
    }
}
pubsub () {
    trusted = [ 'http@{clusterNode}' ]
}
'sess-man' () {
    'audit-log' () {}
    msgoffline () {}
    'pep-simple' () {}
    'presence-offline' () {}
}

注:从向导生成的配置可知,“dataSource ()”函数的配置用于集成MongoDB数据库。

2.2.3 重启服务是配置生效

systemctl restart tigase-server

然后,你可以使用如下命令查看倾听端口的变化,

netstat -antp | grep `pgrep -u tigase java`

可见如下显示,

tcp6       0      0 :::5290                 :::*                    LISTEN      3721/java
tcp6       0      0 :::8080                 :::*                    LISTEN      3721/java
tcp6       0      0 :::5269                 :::*                    LISTEN      3721/java
tcp6       0      0 :::5280                 :::*                    LISTEN      3721/java
tcp6       0      0 :::5222                 :::*                    LISTEN      3721/java
tcp6       0      0 :::5223                 :::*                    LISTEN      3721/java
tcp6       0      0 127.0.0.1:57378         127.0.0.1:27017         ESTABLISHED 3721/java
tcp6       0      0 127.0.0.1:57380         127.0.0.1:27017         ESTABLISHED 3721/java

2.2.4 注册管理员


如上图所示,
单击【Register】
窗口显示如下,

如上图所示,
单击【Next】
窗口显示如下,

如上图所示,
按如下参数范例填写,
Username: admin
Password: adminpwd
Email: will@cmdschool.org
单击【Next】
窗口显示如下,

如上图所示,
单击【Close】即可完成管理员账号的创建

2.2.5 测试管理员登录

http://cmdschool.org:8080/admin/
Username: admin@cmdschool.org
Password: adminpwd

参阅文档
=======================

官方文档
———
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#_recommended_database_versions

管理员创建失败
————
https://github.com/tigase/tigase-server/issues/52

没有评论

发表评论

XMPP
如何部署Tigase Server 8.x?

1 基础知识 1.1 压缩包命名规则 tigase-server-<version>-S …

XMPP
如何配置Tigase的SSL/TLS证书?

1 基础知识 1.1 证书的基础知识 如果你不熟悉证书的相关知识,请参阅以下链接学习, https: …

XMPP
如何部署Tigase的客户端?

1 基础知识 1.1 软件介绍 Psi是专为XMPP(Tigase)网络设计的免费即时通讯应用程序。 …