Tigase 8.0开发环境搭建_开源项目

解压下载的文件

tar -zxvf tigase-server-xxx-dist-max.tar.gz

gzip  -d  tigase-xxx.tar.gz
tar -xvf tigase-xxx.tar

创建一个/etc/yum.repos.d/mongodb-org-4.0.repo

[mongodb-org-4.0] 
name = MongoDB Repository
baseurl = https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck = 1
enabled = 1
gpgkey = https:// www.mongodb.org/static/pgp/server-4.0.asc
sudo yum install -y mongodb-org



  • 1

默认情况下,MongoDB使用mongod用户帐户运行并使用以下默认目录:

/var/lib/mongo (数据目录)

/var/log/mongodb (日志目录)

sudo service mongod start  启动
sudo service mongod stop 停止
sudo service mongod restart 重启

使用

mongo         不要写错(写成mongod)



  • 1
tail -f /var/log/mongodb/mongod.log   查看是否启动成功



  • 1

mongodb 卸载(默认安装路径)

sudo service mongod stop
sudo yum erase $(rpm -qa | grep mongodb-org)
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo



  • 1
  • 2
  • 3
  • 4

跟随系统自动启动

sudo chkconfig mongod on



  • 1​

Tigase 8.0开发环境搭建_mongodb_02

更新于2019年6月2日 2:40

MongoDB启动异常 报错 及 正确的关闭方法

Mongo的远程连接 mongodb 4.0.10

注意:Mongo的远程连接需要打开权限控制

mongo
use admin;
#首先添加个管理员账号(root权限):
db.createUser({user:"root",pwd:"xxx",roles:[{role:"root",db:"admin"}]});
db.auth("root","xxx");返回1表示成功
#添加个普通账号(读写权限): (命令中的db 代表用户所分配的数据库)
db.createUser({user:"abc",pwd:"xxx",roles:[{role:"readWrite",db:"admin"}]});
db.auth("abc","xxx") ;返回1表示成功

停止服务

service mongod stop



  • 1

修改 /etc/mongod.conf 配置文件

vi /etc/mongod.conf



  • 1
net:
bindIp: 0.0.0.0 注意bindIp:后面有空格,空格
serurity:
authorization: enabled #开启远程密码验证
setParameter:
enableLocalhostAuthBypass: true # 本地登录时不需要密码


一定要注意 冒号后面需要空格

Tigase 8.0开发环境搭建_mongodb_03

service mongod restart



  • 1
mongo --port 27017 -u myUserAdmin -p 'abc123' --authenticationDatabase 'admin'



  • 1

mongo --version 4.0.10

cat /proc/version 查看CentOS版本

更新于2019年6月2日 10:22

XMPP协议 搭建Tigase开发环境

tigase 配置

vi etc/config.tdsl

'config-type' = 'setup'

​http () {​​​​setup () {​ ​​​'admin-user' = 'admin'​​​​'admin-password' = '123456'​​​​}​ ​​​}​ ​​​dataSource {​ ​​​default () {​​​​uri = 'mongodb://user:123456@localhost/tigasedb'​ ​​​}​ ​​​}​ ​​​userRepository {​ ​​​default () {}​​​​}​ ​​​authRepository {​ ​​​default () {}​​​​}​

日志配置

debug = [ 'xmpp.XMPPIOService' ]
You can also have debugging switched on for many packages/classes at the same time:
debug = [ 'cluster' , 'xmpp.XMPPIOService' ]
Other packages you might be interested in are:
io can print out what is going on a very low level network level including TLS/SSL stuff.
xml would print the XML parser debugging data.
cluster would print all the clustering related stuff.
xmpp.impl would print logs from all plugins loaded to Tigase server.

​Non-Tigase packages​​​​To enable logging for your own packages from those different than Tigase, you have to use another option which has been made available for this:​ ​​​debug-packages = [ your.com.package ]​

tigase.conf配置

TIGASE_OPTIONS=" --property-file etc/config.tdsl "



  • 1

系统服务

For systemd-based linux distributions
Once installation is complete you may start Tigase as a typical systemd service using following command:

​sudo systemctl start tigase-server​​​​To stop it, you may run following command:​


​sudo systemctl stop tigase-server​​​​It is also possible to enable service, to make it start during startup of the operating system:​


​sudo systemctl enable tigase-server​​​​For other linux distributions​ ​​​Once installation is complete, you should be able to start Tigase using the following command:​


​service tigase start​​​​Tigase should begin running in the background. Since Tigase is now installed as a service, it can be controlled with any of the service commands, such as:​


​service tigase stop​


​service tigase restart​


参考配置

# Enable cluster mode
--cluster-mode = true
# Enable debugging for server and xmpp.impl
--debug = 'server,xmpp.impl'
# Set list of virtual hosts (old way)
--virt-hosts = 'example.com,test-1.example.com,test-2.example.com'

​# Configure list of administrator jids​​​​admins = [ 'admin@zeus', 'http@macbook-pro-andrzej.local' ]​ ​​​# Set config type​​​​config-type = '--gen-config-def'​


​# Configure dataSource bean with database configuration​​​​dataSource {​ ​​​# Configure default data source (using default implementation so class is omitted)​​​​default () {​​​​uri = 'jdbc:postgresql://127.0.0.1/tigase?user=test&password=test&autoCreateUser=true'​ ​​​}​


<span ># Configure data source with name exaple.com (will be used by domain example.com)</span>
<span ><span >'example.com'</span></span> <span >(</span><span >)</span> <span >{</span>
uri <span >=</span> <span ><span >'jdbc:mysq://127.0.0.1/example?user=test&password=test&autoCreateUser=true'</span></span>
<span >}</span>


​}​


​# Configure C2S component​​​​c2s {​ ​​​# Enable Stream Management bean​​​​'urn:xmpp:sm:3' () {}​


<span ># Register tigase.server.xmppclient.SeeOtherHostDualIP as seeOtherHost bean</span>
seeOtherHost <span >(</span>class<span >:</span> tigase<span >.</span>server<span >.</span>xmppclient<span >.</span>SeeOtherHostDualIP<span >)</span> <span >{</span><span >}</span>

<span ># Add additional port <span >5224</span> which is SSL port <span >and</span> disable port <span >5223</span></span>
connections <span >(</span><span >)</span> <span >{</span>
<span ><span >'5224'</span></span> <span >(</span><span >)</span> <span >{</span>
socket <span >=</span> ssl
<span >}</span>
<span ><span >'5223'</span></span> <span >(</span>active<span >:</span> <span >false</span><span >)</span> <span >{</span><span >}</span>
<span >}</span>


​}​


​# Configure HTTP API component​​​​http {​ ​​​# Set list of API keys​​​​api-keys = [ 'test1234', 'test2356' ]​ ​​​rest {​ ​​​# Set value of environment property as a path to look for REST scripts​​​​rest-scripts-dir = env('TIGASE_REST_SCRIPTS_DIR')​ ​​​}​​​​}​


​# Register pubsub-2 (class is passed as pubsub-2 name do not have default class assigned)​​​​pubsub-2 (class: tigase.pubsub.cluster.PubSubComponentClustered) {​ ​​​# Set configuration bean properties​​​​pubsubConfig {​ ​​​persistentPep = true​ ​​​}​​​​# Use tigase.pubsub.cluster.ClusteredNodeStrategy as advanced clustering strategy​​​​strategy (class: tigase.pubsub.cluster.ClusteredNodeStrategy) {}​ ​​​}​


​# Configure Session Manager​​​​sess-man {​ ​​​# Here we enable pep, urn:xmpp:mam:1 processors and disable message-archive-xep-0136 processor​​​​pep () {}​ ​​​'urn:xmpp:mam:1' () {}​​​​message-archive-xep-0136 (active: false) {}​


<span ># Define class used as clustering strategy (it is different than <span >default</span> so class is required)</span>
strategy <span >(</span>class<span >:</span> tigase<span >.</span>server<span >.</span>cluster<span >.</span>strategy<span >.</span>OnlineUsersCachingStrategy<span >)</span> <span >{</span><span >}</span>


​}​

debug配置

# Enable debugging for server and xmpp.impl
--debug = 'server,xmpp.impl,xmpp.XMPPIOService'
debug = [ 'cluster' , 'xmpp.XMPPIOService' ]
debug = [ 'server', 'xmpp.impl','xmpp.XMPPIOService','server.ext.handlers' ]
debug = [ 'xmpp.XMPPIOService' ]
debug-packages = [ your.com.package ]
debug = [ 'server', 'xmpp.init' ]
debug-packages = [ 'com.company.CustomPlugin' , 'com.company.custom' ]

​It is possible to enable logging of dropped messages by adding spam to comma separate list of values for --debug property.​​​​--debug=spam​

启动

scripts/tigase.sh start etc/tigase.conf



  • 1

停止运行

scripts/tigase.sh stop etc/tigase.conf



  • 1​

tigase 配置

按照上述配置后,点击以上链接,一路next

Tigase 8.0开发环境搭建_IM_04

分别填写你的主机ip

centos登录的用户名,密码,选择你使用的数据库

数据库配置

如下图

Tigase 8.0开发环境搭建_.net_05

1、你将要创建的数据名

2、填写你的主机ip,这里使用mongodb的默认端口12707

3、填写你将要使用的mongodb账户 用户名A

4、填写你将要使用的mongodb账户 密码P

5、填写你的mongodb创建的具有root权限用户的账号

6、填写填写你的mongodb创建的具有root权限用户的密码

tigase会使用5、6自动创建3、4数据库用户及密码

点击next后,如果没有问题,则check界面一路绿灯

Tigase 8.0开发环境搭建_html_06

数据库已经自动创建成功

重启服务

./scripts/tigase.sh stop
./scripts/{OS}/init.d/tigase start etc/tigase.conf



  • 1
  • 2

where {OS} is your type of Linux, gentoo, debian, mandriva, or redhat​

查下你现在连了多少 连接数
show variables like '%max_connections%';
show global status like 'Max_used_connections';



  • 1
  • 2
  • 3

Tigase-01 使用spark或spi登录Tigase服务器

Tigase8.0 配置Mongodb,数据库表中已经没有tig_paris表

官方工作人员回复:This works as expected as Tigase schema for MongoDB does not require tig_pairs table, see Tigase XMPP Server Schema topic in side https://docs.tigase.net/tigase-server/snapshot/Administration_Guide/html/#mongoDBSupport section.

Tigase 8.0开发环境搭建_开源项目_07

好友关系信息

Tigase 8.0开发环境搭建_mongodb_08

更新于2019年6月13日 9:50

账号密码

Tigase 8.0开发环境搭建_mongodb_09

更新于2019年10月21日 11:26

tigase 8.0 修改端口

Tigase 8.0开发环境搭建_html_10

Windows eclipse环境搭建

将 tigase-mongodb.jar ,tigase-http-api-jetty.jar 导入

pom.xml 中添加依赖

<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.11.1</version>
</dependency>



  • 1
  • 2
  • 3
  • 4
  • 5

编辑C:\Windows\System32\drivers\etc\hosts文件

添加

127.0.0.1(或你自己电脑的ip)       xxx.com



  • 1

注释: xxx.com 为你设置的xmpp服务器的域名,手机需要和电脑使用同一个网段。手机和电脑连接同一个WIFI即可

编辑config.tdsl文件

'config-type' = 'default'
'debug' = 'server','xmpp.impl','xmpp.XMPPIOService','server.ext.handlers.SASLProcessor','spam'
'default-virtual-host' = 'xxx.com'
dataSource () {
default () {
uri = 'mongodb://tigase_user:密码@ip地址/tigasedb'
}
}
http () {
setup () {
'admin-password' = 'xxx..xx'
'admin-user' = 'admin'
}
}



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

Tigase 8.0开发环境搭建_mongodb_11

tigase.conf

#osgiEnabled=(true|false)
#osgiEnabled=false
OSGI=${osgiEnabled}
ENC="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
DRV="-Djdbc.drivers=com.mysql.jdbc.Driver:org.postgresql.Driver:org.apache.derby.jdbc.EmbeddedDriver"
#GC="-XX:+UseBiasedLocking -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewRatio=2 -XX:+CMSIncrementalMode -XX:ParallelCMSThreads=2 -XX:-ReduceInitialCardMarks -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly"
#EX="-XX:+OptimizeStringConcat -XX:+DoEscapeAnalysis -XX:+UseNUMA"
​REMOTE_DEBUG=" -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n "​


​GC_DEBUG=" -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Xloggc:logs/jvm.log -verbose:gc "​


​JMX_REMOTE_IP="-Djava.rmi.server.hostname=0.0.0.0"​


​AWS hostname resolver​


​export INTERNAL_IP="$(curl -s http://169.254.169.254/latest/meta-data/local-hostname)"​


​export EXTERNAL_IP="$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)"​


​JAVA_HOME="C:\Program Files\Java\jdk1.8.0_201"​​​​CLASSPATH=""​


​Possible memory allocation improvements on some CentOS/RHEL systems​


​https://www.ibm.com/developerworks/community/blogs/kevgrig/entry/linux_glibc_2_10_rhel_6_malloc_may_show_excessive_virtual_memory_usage?lang=en​


​export MALLOC_ARENA_MAX=4​


​You should explicitly set young gen size only if you know what you are doing and only after running Load Tests that confirms the assumption!​


​JAVA_YOUNG_GEN_EXPLICIT_SIZE=" -Xmn<young size>[g|m|k] "​


​PRODUCTION_HEAP_SETTINGS=" -Xms5g -Xmx5g ${JAVA_YOUNG_GEN_EXPLICIT_SIZE} " # heap memory settings must be adjusted on per deployment-base!​


​JAVA_XSS=" -Xss228k "​​​​JAVA_DIRECT_MEMORY=" -XX:MaxDirectMemorySize=128m "​ ​​​JAVA_METASPACE=" -XX:MaxMetaspaceSize=128m "​


​JAVA_OPTIONS="${GC} ${GC_DEBUG} ${REMOTE_DEBUG} ${EX} ${ENC} ${DRV} ${JMX_REMOTE_IP} -server ${PRODUCTION_HEAP_SETTINGS} ${JAVA_XSS} ${JAVA_DIRECT_MEMORY} ${JAVA_METASPACE} "​


​TIGASE_OPTIONS=" "​


​TIGASE_OPTIONS=" --property-file config.tdsl "​