Tigase 实战

xmpp

http://www.tigase.org/
https://projects.tigase.org/projects/tigase-server/repository

Tigase Server 是一个轻量级的可伸缩的 Jabber/XMPP 服务器。无需其他第三方库支持,可以处理非常高的复杂和大量的用户数,可以根据需要进行水平扩展。

开源, Java 底层通讯是自己写的一个NIO通讯框架, 最高并发连接可达到单机50w,支持集群(可以根据需要进行水平扩展)。缺点:集群方式复杂–但是tigase 作者维护很活跃,集群测试结果能够支撑比较大的容量,这是吸引人的地方。但经过实际生产运营情况来看,由于其集群方案实现的复杂性,以及单节点容量的有限,对支撑到 50 万用户在集群节点上可能没有信心,所以在到达 50 万用户之前,自己要准备替代方案。可以创建一些自定义的扩展,来处理特定的业务逻辑。

安装

安装Java 7

1
2
3
$ sudo add-apt-repository -y ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get -y install oracle-java7-installer

配置 Java Home

1
JAVA_HOME="${JDKPath}"

新建MySQL数据库

1
2
3
$ mysql -u root -p
mysql> CREATE DATABASE tigase;
mysql> quit

下载Tigase

1
$ wget https://projects.tigase.org/attachments/download/1342/tigase-server-5.2.0-b3447.jar

使用 Console Installer 安装 Tigase

1
$ java -jar tigase-server-5.2.0-b3447.jar -console

The installed application needs a JDK. A java runtime environment (JRE) will be not sufficient.
Enter path:

1
/usr/lib/jvm/java-7-openjdk-amd64

The wizards you want to execute Installation of the Tigase Server
[on, off]

1
on

Configuration of the Tigase Server
[on, off]

1
on

接下来有很长的2个Terms需要接受。

Select target path [/home/lanvige]

1
/usr/local/tigase-server

Select the packs you want to install:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
1 => Base, The base files
2 => Unix Files, Files needed to run the server on Unix like systems
3 => [x] Docs, The documentation
4 => [x] Extras, Extras libraries, MUC, PubSub, STUN, Socks5, Message Archiving, ACS
5 => [x] Groovy scripting, Various Groovy scripts extending server functionality
6 => [x] Derby Database (DB included), Derby database (included) and JDBC driver
7 => [x] MySQL Database driver (DB not included), MySQL JDBC driver (MySQL has to be installed separately)
8 => [ ] PostgreSQL Database driver (DB not included), PostgreSQL JDBC driver (PostgreSQL has to be installed separately)
9 => [ ] SQL Server Database driver (DB not included), SQL Server JDBC driver (SQL Server has to be installed separately)
10 => [ ] OSGi dependencies, If you intend to run Tigase in OSGi mode you need additional libraries. Enabling this Pack will also setup configuration files to start Tigase XMPP server in OSGi mode.
11 => [x] HTTP API Component, Interface for the service administration, monitoring and exchange data between Tigase and external system
12 => [ ] Sources, The server source files, tools and libraries sources are not included
r => Redisplay menu
d => Done

选择安装内容

1
2
3
4
0 [x] Default installation
1 [ ] Default plus extra components
2 [ ] Session Manager only
3 [ ] Network connectivity only

XMPP配置内容

Your XMPP (Jabber) domains [optimus]
Server administrators [admin@optimus]
Admin password [tigase]

选择数据库

1
2
3
4
5
0 [ ] Derby (built-in database)
1 [x] MySQL
2 [ ] PostgreSQL
3 [ ] SQLServer
4 [ ] Other...

Advanced configuration options
[on, off]

1
off

配置MySQL数据库

Database account: [tigase]
Account password: [tigase12]
Database name: [tigasedb]
Database host or IP: [localhost]
Additional database parameters: []

启动

手动启动:

1
2
3
4
5
6
cd /usr/local/tigase-server/
./scripts/tigase.sh start etc/tigase.conf
Starting Tigase:
Tigase running pid=10595
nohup: redirecting stderr to stdout

自动启动:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cd /opt/tigase-server/scripts/redhat/init.d
cp tigase /etc/init.d/
cd /etc/init.d/
chmod a+x tigase
useradd tigase
chown -R tigase:tigase /opt/tigase-server/logs
vim tigase
TIGASE_HOME=/opt/tigase-server --修改tigase安装目录
chkconfig --add /etc/init.d/tigase
chkconfig tigase on
/etc/init.d/tigase start
Starting Tigase XMPP server
Tigase started

客户端测试

http://www.tigase.org/content/psi-initial-configuration

FAQ::

整个流程我没走下来,等到客户端连接时,不知道如何去做了。

REF::