天龙八部游戏架设说明文档
一 服务器硬件环境
1. 至少需要5台linux服务器与1台Windows Server 2003 服务器才能达到环境要求
配置为CPU PD 2.8双核
2. 服务器需要安装2张网卡,一张网卡接入外网.一张网卡与内网连通.内网均接到同一交换机下.
3. 关于对硬盘的要求.如果玩家上线超过千人.建议更换SCSI 万转硬盘.以防数据交互时丢失导致回挡.
二 服务器及配置
1.Linux服务器安装Redhat5 X86.安装所有开发包关联与中文支持.Windows 2003服务器安装企业版就可以.没什么特别的要求.
2.Linux服务器分别命名为tlbb-gameserver tlbb-gameserver1 tlbb-gameserver2 tlbb-worldserver tlbb-billserver 内网IP分别设置为172.16.1.2 172.16.1.3 172.16.1.4 172.16.1.5 172.16.1.6 并将SSH端口监听到内网网卡上. tlbb-gameserver----worldserver 需要安装如下软件:
mysql-connector-odbc-
mysqlclient10-
MySQL-client-standard-
UnixOdbc
Tlbb-billserver 需要安装如下软件:
Oracle
MySQL-server-standard-
Windows 服务器安装Mssql2000 Oracle
内网IP设置为172.16.1.1
三 服务端的架设及配置
1. {C}将tlbbfiles.tar.gz分别传到172.16.1.2~172.16.1.6 Billing.tar.gz 传到172.16.1.6
2. {C}先将tlbb.dmp 与tl_gameuser.dmp 还原到oracle数据库.在还原数据库之前.先在oracle创建3个帐户.
--创建用户
create user tlbb IDENTIFIED BY JC4KQO1EJP;
create user tl_gameuser IDENTIFIED BY S0DHRFZVZ5;
create user tlbb_read IDENTIFIED BY JC4KQO1EJP;
--设置角色权限与系统权限
-- Grant/Revoke role privileges
grant connect to TLBB;
grant resource to TLBB;
-- Grant/Revoke system privileges
grant alter session to TLBB;
grant create cluster to TLBB;
grant create database link to TLBB;
grant create sequence to TLBB;
grant create session to TLBB;
grant create synonym to TLBB;
grant create table to TLBB;
grant create view to TLBB;
另外两个帐户也是同样的设置
Imp tlbb/JC4KQO1EJP@ora
Imp tl_gameuser/S0DHRFZVZ5@ora
导入完成之后用pl/sql以system用户登陆上去.将tl_gameuser.userbasic授予tlbb用户的访问.如图1
{C}{C}
然后设置tlbb用户的对象权限.如图2
{C}{C}
并将tlbb用户Procedures下带有红X的储存过程重新编译一下.如图3
{C}{C}
帐户数据库弄好后.开始导入游戏数据库及统计数据库.用SQLyog以root连接,建立tlbbdb.将DBInit_0_9_0020_mysql.sql导入此库即可.然后设置帐户及拥有的权限.tlbbdb_stat.sql操作和上面一样.
--建立帐户tlbb tlbbtools
use mysql;
insert into mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) value ('172.16.%.%', 'tlbb', '*C
insert into mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) value ('172.16.%.%', 'tlbbtools', '*
--设置访问权限
insert into mysql.db ( Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Execute_priv) value( '172.16.%.%', 'tlbbdb','tlbb', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
insert into mysql.db ( Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Execute_priv) value( '172.16.%.%', 'tlbbdb','tlbbtools', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'N', 'Y', 'Y', 'N', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'Y');
insert into mysql.db ( Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Execute_priv) value( '172.16.%.%', 'tlbbdb_stat','tlbb', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N');
3. {C}在tlbb-billserver /home 目录建立tlbb文件夹.并将billing.tar.gz解压到此文件里.
4. {C}更改/home/tlbb/etc下gbs.conf db_hash.conf host.lst这三个文件里的IP,及oracle连接信息.需要更改的项如下
db_hash.conf 文件
#散列数量:
HASHING_NUM = 1
#散列表0:
MAXDBCONNS0 = 5
DBUSER_DB0 = tlbb
DBPASS_DB0 = JC4KQO1EJP
DBTNS_DB0 = ora
gbs.conf 文件
MAXDBCONNS_BILL = 20
DBUSER_GAMEBILL = tlbb
DBPASS_GAMEBILL = JC4KQO1EJP
DBTNS_GAMEBILL = ora
#
MAXDBCONNS_AUTH = 20
DBUSER_GAMEAUTH = tl_gameuser # for userbasic
DBPASS_GAMEAUTH = S0DHRFZVZ5
DBTNS_GAMEAUTH = ora
host.lst 文件
x.x.x.x --world服务的外网IP
172.16.1.5 --world服务的内网IP
4. {C}设置oracle客户端的tnsnames.ora 将oracle服务名改为ora
ORA
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora
)
)
5. {C}启动billing服务 ./tlbb start 如果出现**************draw information end************ 的字样就表示启动成功了,如图4
{C}{C}
6. {C}配置world服务器.将tlbbfiles.tar.gz到/home 更改/home/tlbb/Server/Config下的ServerInfo.ini ShareMemInfo.ini LoginInfo.ini 这3个文件.
ServerInfo.ini
[System]
Desc0=功能:配置服务器端程序的相关情况;
Desc1=IP0、Port0指外网的地址和端口;
Desc2=IP1、Port1指内网的地址和端口;
Desc3=Type:Game=0;Login=1;
;当前服务器ID,(0,1,3,0根据服务器定)
CurrentServerID=0
;当前游戏世界的服务器端程序数量
ServerNumber=4
[Mother]
IP=x.x.x.x ;设置为windows服务器的外网IP
Port=1014
[World]
IP=x.x.x.x ;设置为world的外网IP
Port=777
[Billing]
;配置可以尝试连接的billing数量
Number=1
;默认的连接billing的IP
IP0=x.x.x.x ;设置为billing服务的外网IP
;默认的连接billing的连接端口
Port0=15680
IP1=
Port1=10101
IP2=
Port2=10101
IP3=
Port3=10101
IP4=
Port4=10101
[Proxy]
;负责网通用户接入电信的代理服务器内网IP(暴露给游戏服务器的IP)
Proxy0ForCncUser= x.x.x.x
;Proxy1ForCncUser=
;负责电信用户接入网通的代理服务器内网IP(暴露给游戏服务器的IP)
Proxy0ForCtcUser=
;Proxy1ForCtcUser=
;从教育网代理服务器过来的连接转发给电信代理出口
Proxy0ForEduUser= x.x.x.x
;Proxy1ForEduUser=
[Server0]
;游戏服务器端程序号
ServerID=0
;此游戏服务器端程序所在的服务器号
MachineID=0
;外网IP地址,用与客户端连接
IP0=x.x.x.x ;tlbb-gameserver 的外网IP
;外网端口
Port0=3731
;内网IP地址,用与服务器端程序间连接
IP1=172.16.1.2
;内网端口
Port1=8880
;服务器端程序类型,如:GameServer,LoginServer
Type=0
;网通的代理服务器IP,这个填写代理OUT-IP就是玩家连接的代理IP
IP(CNC)= x.x.x.x
;网通的代理服务器端口
Port(CNC)=1000
;电信的代理服务器IP
IP(CTC)=
;电信的代理服务器端口
Port(CTC)=0
;教育网的代理服务器IP
IP(EDU)= x.x.x.x
;教育网的代理服务器端口
Port(EDU)=1000
;ShareMemory共享Key
HumanSMKey=1001
;玩家商店共享Key
PlayShopSMKey=4001
;物品序号
ItemSerialKey=7001
CommisionShopKey=6001
EnableShareMem=1
[Server1]
ServerID=1
MachineID=1
IP0=x.x.x.x ;tlbb-gameserver1 的外网IP
Port0=3732
IP1=172.16.1.3
Port1=8881
Type=0
IP(CNC)= x.x.x.x
Port(CNC)=1000
IP(CTC)=
Port(CTC)=0
IP(EDU)= x.x.x.x
Port(EDU)=1000
HumanSMKey=1002
PlayShopSMKey=4002
ItemSerialKey=7002
CommisionShopKey=6002
EnableShareMem=1
[Server2]
ServerID=2
MachineID=3
IP0=x.x.x.x ;Login服务的外网IP.与world的IP相同
Port0=7377
IP1=x.x.x.x ;同上
Port1=8882
Type=1
IP(CNC)= x.x.x.x
Port(CNC)=1000
IP(CTC)=
Port(CTC)=0
IP(EDU)= x.x.x.x
Port(EDU)=1000
HumanSMKey=1003
PlayShopSMKey=4003
ItemSerialKey=7003
CommisionShopKey=6003
EnableShareMem=0
[Server3]
ServerID=3
MachineID=2
IP0=x.x.x.x ;tlbb-gameserver2 的外网IP
Port0=3734
IP1=172.16.1.4
Port1=8883
Type=0
IP(CNC)= x.x.x.x
Port(CNC)=1000
IP(CTC)=
Port(CTC)=0
IP(EDU)= x.x.x.x
Port(EDU)=1000
HumanSMKey=1003
PlayShopSMKey=4003
ItemSerialKey=7003
CommisionShopKey=6003
EnableShareMem=1
ShareMemInfo.ini
[System]
DBIP=172.16.1.6 ;数据库ip
DBPort=3306 ;数据库端口
DBName=tlbbdb ;数据库名称
DBUser=tlbb ;用户名
DBPassword=t!lbb ;密码
SMUInterval=1200000 ;world数据存盘时间(毫秒)
DATAInterval=900000 ;Human数据存盘时间(毫秒)
CryptPwd=0 ;密码是否加密,1是加密,0是不加密
[ShareMem]
KeyCount=5 ;ShareObj 个数
Key0=2001 ;第一个key的编号
Type0=2 ;HumanSMU类型 1
Key1=3001
Type1=3
Key2=8001
Type2=8
Key3=9001
Type3=9
Key4=5001
Type4=5
LoginInfo.ini
[System]
LoginID=2 ;当前Login服务器端程序的LoginID
DBIP=172.16.1.6
DBPort=3306
DBName=tlbbdb
DBUser=tlbb
DBPassword=t!lbb
ClientVersion=1005
DBConnectCount=10
TurnPlayerCount=100
CryptPwd=0 ;密码是否加?
EnableProxyConnect=0
7. {C}配置odbc.ini与odbcinst.ini,这里非常重要.请按照参考如下配置
odbc.ini
[tlbbdb]
Driver = /usr/lib/libmyodbc3.so
Description = MyODBC 3.51 Driver DSN
SERVER = 172.16.1.6
PORT = 3306
USER = tlbb
Password = t!lbb
Database = tlbbdb
OPTION = 3
SOCKET =
odbcinst.ini
# Example driver definitinions
#
#
# Included in the unixODBC package
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1
# Driver from the MyODBC package
# Setup from the unixODBC package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1
保存OK后.设置$LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=/home/tlbb/Server:$LD_LIBRARY_PATH
并编辑/etc/profile 写入以上内容保存.
8. {C}测试服务启动是否正常,cd /home/tlbb/Server ./shm start 如果出错了服务会自动中止.请查看Log里的日志文件进行调试.
9. {C}shm启动没问题的话就将run.sh和stop.sh 传到root文件夹下.进行启动.启动完成后.ps -ex 看进程是否存在着.如图5
{C}{C}
为了确定服务启动成功,telnet 172.16.1.5 777 7377 如能连上就表示OK了.这时候应该查看billing服务是否接收到Login服务的响应.到bill服务器./tlbb list
如果没显示出Login服务的IP及World服务的编号说明host.lst配置有问题.请查看log文件夹中gbs-x-x.log进行调试.
10. World服务器配置完成后接下来就是Game服务器的配置.配置基本上跟World的配置差不多.需要更改ServerInfo.ini ShareMemInfo.ini 这两个文件.可直接将World服务器的这两个文件拷贝过来覆盖.然后更改如下几个项
ServerInfo.ini
这个文件不用更改.如果是tlbb-gameserver1就需要更改.
;当前服务器ID,(0,1,3,0根据服务器定)
CurrentServerID=0 ;这里不变.如果是tlbb-gameserver1,就需要设置为1,按ServerID=X 而定.
ShareMemInfo.ini
[ShareMem]
KeyCount=4 ;ShareObj 个数
Key0=1001 ;第一个key的编号
Type0=1 ;HumanSMU类型 1
Key1=4001
Type1=4
Key2=7001
Type2=7
Key3=6001
Type3=6
这里是根据ServerInfo.ini设置的.
odbc.ini和odbcinst.ini 如上面所说的设置,不再赘述.
先启动./shm start 看看是否正常.