2019-08-16

搭建 teamtalk 服务器

(三)配置文件 修改im配置

网络配置说明文件 INSTALL.md


image.png

配置文件所在目录

image.png

常见部署方案

假设所有服务都部署在一台机器上

1.纯公司内网

安装的机器内网ip为: 192.168.1.2

login_server:

ClientListenIP=192.168.1.2      
ClientPort=8008
HttpListenIP=192.168.1.2
HttpPort=8080
MsgServerListenIP=192.168.1.2   
MsgServerPort=8100
msfs=http://192.168.1.2:8700/
discovery=http://192.168.1.2/api/discover

msg_server:

ListenIP=192.168.1.2
ListenPort=8000

ConcurrentDBConnCnt=2
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

LoginServerIP1=192.168.1.2
LoginServerPort1=8100

RouteServerIP1=192.168.1.2
RouteServerPort1=8400

PushServerIP1=192.168.1.2
PushServerPort1=8500

FileServerIP1=192.168.1.2
FileServerPort1=8600

IpAddr1=192.168.1.2     
IpAddr2=192.168.1.2     
MaxConnCnt=100000

route_server:

ListenIP=192.168.1.2            
ListenMsgPort=8400

msfs_server:

ListenIP=192.168.1.2        
ListenPort=8600
BaseDir=./tmp
FileCnt=0
FilesPerDir=30000
GetThreadCount=32
PostThreadCount=我们为您提供

file_server:

Address=192.168.1.2 
ListenPort=8500         
TaskTimeout=60        

db_proxy:

ListenIP=192.168.1.2    
ListenPort=10600
ThreadNum=48        # double the number of CPU core
MsfsSite=192.168.1.2    

#configure for mysql
DBInstances=teamtalk_master,teamtalk_slave
#teamtalk_master
teamtalk_master_host=127.0.0.1
teamtalk_master_port=3306
teamtalk_master_dbname=teamtalk
teamtalk_master_username=root
teamtalk_master_password=12345
teamtalk_master_maxconncnt=16

#teamtalk_slave
teamtalk_slave_host=127.0.0.1
teamtalk_slave_port=3306
teamtalk_slave_dbname=teamtalk
teamtalk_slave_username=root
teamtalk_slave_password=12345
teamtalk_slave_maxconncnt=16


#configure for unread
CacheInstances=unread,group_set,token,sync,group_member
#未读消息计数器的redis
unread_host=127.0.0.1
unread_port=6379
unread_db=我们为您提供
unread_maxconncnt=16

#群组设置redis
group_set_host=127.0.0.1
group_set_port=6379
group_set_db=2
group_set_maxconncnt=16

#同步控制
sync_host=127.0.0.1
sync_port=6379
sync_db=3
sync_maxconncnt=我们为您提供

#deviceToken redis
token_host=127.0.0.1
token_port=6379
token_db=4
token_maxconncnt=16

#GroupMember
group_member_host=127.0.0.1
group_member_port=6379
group_member_db=5
group_member_maxconncnt=48

http_msg_server:

ListenIP=192.168.1.2
ListenPort=8400

ConcurrentDBConnCnt=4
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

RouteServerIP1=192.168.1.2
RouteServerPort1=8200
#RouteServerIP2=localhost   
#RouteServerPort2=8201

push_server:

ListenIP=192.168.1.2
ListenPort=8500

CertPath=apns-dev-cert.pem
KeyPath=apns-dev-key.pem
KeyPassword=好像有点感冒咳嗽的感觉……在线的人数越来越多,不想和你说什么话可以理解别人了,我要把所有事情交给别人掌控一切……………………好想好想睡@mogujie

#SandBox
#1: sandbox 0: production
SandBox=0   

2.公网ip

安装的机器为多网卡,包含内网网卡和公网网卡
内网ip为:192.168.1.2
公网ip为122.222.222.222

login_server:

ClientListenIP=122.222.222.222      
ClientPort=8008
HttpListenIP=122.222.222.222    
HttpPort=8080
MsgServerListenIP=192.168.1.2   
MsgServerPort=8100
msfs=http://122.222.222.222 :8700/
discovery=http://122.222.222.222/api/discover

msg_server:

ListenIP=122.222.222.222
ListenPort=8000

ConcurrentDBConnCnt=2
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

LoginServerIP1=192.168.1.2
LoginServerPort1=8100

RouteServerIP1=192.168.1.2
RouteServerPort1=8400

PushServerIP1=192.168.1.2
PushServerPort1=8500

FileServerIP1=192.168.1.2
FileServerPort1=8600

IpAddr1=122.222.222.222     
IpAddr2=122.222.222.222     
MaxConnCnt=100000

route_server:

ListenIP=192.168.1.2            
ListenMsgPort=8400

msfs_server:

ListenIP=192.168.1.2;122.222.222.222        
ListenPort=8600
BaseDir=./tmp
FileCnt=0
FilesPerDir=30000
GetThreadCount=32
PostThreadCount=我们为您提供

file_server:

Address=122.222.222.222 
ListenPort=8500         
TaskTimeout=60        

db_proxy:

ListenIP=192.168.1.2    
ListenPort=10600
ThreadNum=48        # double the number of CPU core
MsfsSite=192.168.1.2    

#configure for mysql
DBInstances=teamtalk_master,teamtalk_slave
#teamtalk_master
teamtalk_master_host=127.0.0.1
teamtalk_master_port=3306
teamtalk_master_dbname=teamtalk
teamtalk_master_username=root
teamtalk_master_password=12345
teamtalk_master_maxconncnt=16

#teamtalk_slave
teamtalk_slave_host=127.0.0.1
teamtalk_slave_port=3306
teamtalk_slave_dbname=teamtalk
teamtalk_slave_username=root
teamtalk_slave_password=12345
teamtalk_slave_maxconncnt=16


#configure for unread
CacheInstances=unread,group_set,token,sync,group_member
#未读消息计数器的redis
unread_host=127.0.0.1
unread_port=6379
unread_db=我们为您提供
unread_maxconncnt=16

#群组设置redis
group_set_host=127.0.0.1
group_set_port=6379
group_set_db=2
group_set_maxconncnt=16

#同步控制
sync_host=127.0.0.1
sync_port=6379
sync_db=3
sync_maxconncnt=我们为您提供

#deviceToken redis
token_host=127.0.0.1
token_port=6379
token_db=4
token_maxconncnt=16

#GroupMember
group_member_host=127.0.0.1
group_member_port=6370
group_member_db=5
group_member_maxconncnt=48

http_msg_server:

ListenIP=192.168.1.2
ListenPort=8400

ConcurrentDBConnCnt=4
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

RouteServerIP1=192.168.1.2
RouteServerPort1=8200
#RouteServerIP2=localhost   
#RouteServerPort2=8201

push_server:

ListenIP=192.168.1.2
ListenPort=8500

CertPath=apns-dev-cert.pem
KeyPath=apns-dev-key.pem
KeyPassword=xxxxxxxx

#SandBox
#1: sandbox 0: production
SandBox=0   

3.公网ip,路由器映射

此种情况请确保在内网下可以访问路由器映射的外网ip
安装的机器为单网卡,外网由路由器映射
内网ip为: 192.168.1.2
路由器映射的公网ip为: 122.222.222.222

login_server:

ClientListenIP=192.168.1.2      
ClientPort=8008
HttpListenIP=192.168.1.2
HttpPort=8080
MsgServerListenIP=192.168.1.2   
MsgServerPort=8100
msfs=http://122.222.222.222 :8700/
discovery=http://122.222.222.222/api/discover

msg_server:

ListenIP=192.168.1.2
ListenPort=8000

ConcurrentDBConnCnt=2
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

LoginServerIP1=192.168.1.2
LoginServerPort1=8100

RouteServerIP1=192.168.1.2
RouteServerPort1=8400

PushServerIP1=192.168.1.2
PushServerPort1=8500

FileServerIP1=192.168.1.2
FileServerPort1=8600

IpAddr1=122.222.222.222     
IpAddr2=122.222.222.222     
MaxConnCnt=100000

route_server:

ListenIP=192.168.1.2            
ListenMsgPort=8400

msfs_server:

ListenIP=192.168.1.2        
ListenPort=8600
BaseDir=./tmp
FileCnt=0
FilesPerDir=30000
GetThreadCount=32
PostThreadCount=我们为您提供

file_server:

Address=122.222.222.222 
ListenPort=8500         
TaskTimeout=60        

db_proxy:

ListenIP=192.168.1.2    
ListenPort=10600
ThreadNum=48        # double the number of CPU core
MsfsSite=192.168.1.2    

#configure for mysql
DBInstances=teamtalk_master,teamtalk_slave
#teamtalk_master
teamtalk_master_host=127.0.0.1
teamtalk_master_port=3306
teamtalk_master_dbname=teamtalk
teamtalk_master_username=root
teamtalk_master_password=12345
teamtalk_master_maxconncnt=16

#teamtalk_slave
teamtalk_slave_host=127.0.0.1
teamtalk_slave_port=3306
teamtalk_slave_dbname=teamtalk
teamtalk_slave_username=root
teamtalk_slave_password=12345
teamtalk_slave_maxconncnt=16


#configure for unread
CacheInstances=unread,group_set,token,sync,group_member
#未读消息计数器的redis
unread_host=127.0.0.1
unread_port=6379
unread_db=我们为您提供
unread_maxconncnt=16

#群组设置redis
group_set_host=127.0.0.1
group_set_port=6379
group_set_db=2
group_set_maxconncnt=16

#同步控制
sync_host=127.0.0.1
sync_port=6379
sync_db=3
sync_maxconncnt=我们为您提供

#deviceToken redis
token_host=127.0.0.1
token_port=6379
token_db=4
token_maxconncnt=16

#GroupMember
group_member_host=127.0.0.1
group_member_port=6379
group_member_db=5
group_member_maxconncnt=48

http_msg_server:

ListenIP=192.168.1.2
ListenPort=8400

ConcurrentDBConnCnt=4
DBServerIP1=192.168.1.2
DBServerPort1=10600
DBServerIP2=192.168.1.2
DBServerPort2=10600

RouteServerIP1=192.168.1.2
RouteServerPort1=8200
#RouteServerIP2=localhost   
#RouteServerPort2=8201

push_server:

ListenIP=192.168.1.2
ListenPort=8500

    //苹果推送p12文件
CertPath=apns-dev-cert.pem
    //苹果推送p12文件密码路径?
KeyPath=apns-dev-key.pem
    //苹果推送p12文件 解压密码
KeyPassword=xxxxxx

#SandBox
#1: sandbox 0: production
SandBox=0   

修改web的配置

修改web的配置


image.png
>$config['msfs_url'] = 'http://msfs.teamtalk.im:8700/';
>$config['http_url'] = 'http://10.11.5.171:8400';

修改数据库参数 保存退出


image.png
安装PB
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -zxvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure --prefix=/usr/local/protobuf
 make -j 2 && make install
编译安装

monTalkServer 服务器目录

cd ~
mkdir -p /root/monTalkServer/server/src/base/pb/lib/linux/
mkdir -p /root/monTalkServer/server/src/base/pb/protocol
cp /usr/local/protobuf/lib/libprotobuf-lite.a /root/monTalkServer/server/src/base/pb/lib/linux/
cp  -r /usr/local/protobuf/include/* /root/monTalkServer/server/src/base/pb/
生成pb协议
cd /root/monTalkServer/pb
export PATH=$PATH:/usr/local/protobuf/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/protobuf/lib
sh create.sh
sh sync.sh
9安装依赖
cd /root/monTalkServer/server/src
sh make_log4cxx.sh
sh make_hiredis.sh

报错
‘void log4cxx::spi::LocationInfo::write(log4cxx::helpers::ObjectOutputStream&, log4cxx::helpers::Pool&) const’:
locationinfo.cpp:163:21: error: narrowing conversion of ‘237’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
0x78, 0x70 };
^
locationinfo.cpp:163:21: error: narrowing conversion of ‘153’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
locationinfo.cpp:163:21: error: narrowing conversion of ‘187’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
locationinfo.cpp:163:21: error: narrowing conversion of ‘225’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
locationinfo.cpp:163:21: error: narrowing conversion of ‘145’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
locationinfo.cpp:163:21: error: narrowing conversion of ‘165’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
make[3]: *** [locationinfo.lo] 错误 1
make[3]: 离开目录“/root/monTalkServer/server/src/log4cxx/apache-log4cxx-0.10.0/src/main/cpp”
make[2]: *** [install-recursive] 错误 1
make[2]: 离开目录“/root/monTalkServer/server/src/log4cxx/apache-log4cxx-0.10.0/src/main”
make[1]: *** [install-recursive] 错误 1
make[1]: 离开目录“/root/monTalkServer/server/src/log4cxx/apache-log4cxx-0.10.0/src”
make: *** [install-recursive] 错误 1
cp: 无法获取"log4cxx/include" 的文件状态(stat): 没有那个文件或目录
cp: 无法获取"log4cxx/lib/liblog4cxx.so*" 的文件状态(stat): 没有那个文件或目录

你可能感兴趣的:(2019-08-16)