那爱 发表于 2024-3-12 11:36:25

征途源代码 - 网游单机下载 站


[ 本帖最后由 bfdz49 于 2019-12-20 14:16 编辑 ]\n\n 编辑 配置高亮<br>
使用SecureCRT登录linux服务器用VIM时显示彩色语法高亮的方法<br>
链接:https://pan.baidu.com/s/1PB373gOBDte9D8V-y-45zQ提取码:55cz1<br>
<br>
:在$HOME 目录下 vim&nbsp; &nbsp;~/.vimrc 建立一个文件<br>
2:在最后面添两句:syntax on&nbsp; &nbsp;和 set nocp ,然后保存<br>
3:在SecureCRT中设置 选项-&gt;会话选项-&gt;终端-&gt;仿真-&gt;终端:Linux<br>
4:重新登录linux服务器,打开 vim,现在就可自动对语法进行加亮了。<br>
Mysql还原数据库<br>
source 数据名.sq<br>
<br>
服务器架设<br>
游戏服务器注意事项<br>
一、硬件的安装<br>
1、保证服务器风扇正常转动。<br>
2、保证服务器各个提示灯是否正常。<br>
3、开机察看服务器有无报警情况。<br>
4、开机察看服务器能否正常启动(不插鼠标键盘的情况下)<br>
二、系统的安装<br>
安装RHEL 4.0<br>
选择自动分区。<br>
分别给2块网卡配置ip,方便以后配置。<br>
不启用防火墙。<br>
增加中文语言包。<br>
选择软件包时,只选择开发包.<br>
三、系统的简单设置<br>
1、防火墙的简单设置:<br>
&nbsp;&nbsp;vi /etc/rc.d/forward<br>
内容:<br>
#!/bin/bash<br>
/sbin/iptables -F<br>
/sbin/iptables -F -t nat<br>
/sbin/depmod -a<br>
/sbin/modprobe ip_tables<br>
/sbin/modprobe ip_conntrack<br>
/sbin/modprobe ip_nat_ftp<br>
/sbin/modprobe ip_conntrack_ftp<br>
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<br>
#sshd<br>
/sbin/iptables -A INPUT -s 218.80.198.0/24 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br>
/sbin/iptables -A INPUT -s 192.168.0.0/16 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br>
#ftp server<br>
#/sbin/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT<br>
#/sbin/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT<br>
<br>
/sbin/iptables -A INPUT -j DROP<br>
<br>
保存后退出。<br>
&nbsp; &nbsp;chmod 744 /etc/rc.d/forward<br>
&nbsp; &nbsp;然后运行防火墙脚本,以后根据需求修改脚本。<br>
2、设置系统自动启动防火墙<br>
&nbsp;&nbsp;vi /etc/rc.d/rc.local<br>
增加一行<br>
&nbsp; &nbsp;/etc/rc.d/forward<br>
&nbsp; &nbsp; 保存后退出<br>
3、设置文件打开数<br>
1) 修改/etc/security/limits.conf 增加2行:<br>
*&nbsp; &nbsp;&nbsp; &nbsp; soft&nbsp; &nbsp; nofile&nbsp;&nbsp;4096<br>
*&nbsp; &nbsp;&nbsp; &nbsp; hard&nbsp; &nbsp; nofile&nbsp;&nbsp;65535<br>
2) 修改/etc/pam.d/login 增加1行<br>
session required&nbsp;&nbsp;pam_limits.so<br>
可用:<br>
echo &quot;*&nbsp; &nbsp;&nbsp;&nbsp;soft&nbsp; &nbsp; nofile&nbsp;&nbsp;4096&quot; &gt;&gt;/etc/security/limits.conf<br>
echo &quot;*&nbsp; &nbsp;&nbsp; &nbsp; hard&nbsp; &nbsp; nofile&nbsp;&nbsp;65535&quot; &gt;&gt;/etc/security/limits.conf<br>
echo &quot;session required&nbsp;&nbsp;pam_limits.so&quot; &gt;&gt;/etc/pam.d/login<br>
4、修改默认语言<br>
&nbsp; &nbsp;vi /etc/sysconfig/i18n 修改<br>
LANG=&quot;zh_CN.GB2312&quot;<br>
新建游戏运行用户ztgame,设置密码<br>
useradd ztgame<br>
passwd ztgame<br>
用ztgame用户登录服务器,修改vi /home/ztgame/.bash_profile增加一行<br>
ulimit -c unlimited<br>
&nbsp; &nbsp;保存后退出。<br>
四、游戏环境的搭建(按照4台网关服务器,5台场景服务器,1台数据库服务器的构架)<br>
1、服务器IP设置<br>
4台网关服务器配置外网ip和内网ip,5台场景服务器和数据库服务器只配置内网ip,并且服务器默认网关为第一台网关服务器的内网ip。<br>
服务器以服务器应用-序号-机房序号命名(例GWServer01-CHJ01)。<br>
修改/etc/hosts。<br>
例子:<br>
127.0.0.1&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;GWServer01-CHJ01 localhost.localdomain localhost<br>
192.168.100.101&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;GWServer02-CHJ01<br>
………<br>
192.168.100.104&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ScenServer01-CHJ01<br>
………<br>
192.168.100.109&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;DBServer-CHJ01<br>
2、公钥的生成<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;在ztgame的用户下登陆第一台网关服务器,输入ssh-keygen -t dsa<br>
接受 ~/.ssh/id_dsa 的默认位置。输入一个与你的帐号口令不同的口令句,再输入一次来确认。公钥被写入 ~/.ssh/id_dsa.pub。密钥被写入 ~/.ssh/id_dsa。<br>
使用以下命令改变你的 .ssh 目录的许可权限: <br>
chmod 755 ~/.ssh<br>
把 ~/.ssh/id_dsa.pub用scp命令传到其它剩余9台服务器<br>
scp~/.ssh/id_dsa.pub <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e242a393f333b1e6f676c706f6866706f6e6c706f6e66"></a>:~/.ssh/authorized_keys <br>
在其它9台服务器下使用以下命令改变你的 authorized_keys 文件的许可权限: <br>
chmod 755 ~/.ssh<br>
chmod 644 ~/.ssh/authorized_keys<br>
3、数据库服务器的安装<br>
#首先确定你是root用户<br>
获得mysql-4.1.*.tar包,用tar -zxvf mysql-4.1.*tar解开压缩包,然后进入mysql-4.1.*目录<br>
#根据体统类型选择编译方式<br>
#i386体系结构的<br>
CFLAGS=&quot;-O3 -mcpu=pentiumpro&quot; CXX=gcc CXXFLAGS=&quot;-O3 -mcpu=pentiumpro -felide-constructors -fno-exceptions -fno-rtti&quot; ./configure --with-raid --enable-thread-safe-client --enable-assembler&nbsp;&nbsp;--with-server-suffix =&quot; for &gt;&gt;&gt;MySQL Database of Zebra by Yhc&lt;&lt;&lt;&quot; --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench<br>
#64位系统,x86_64<br>
CFLAGS=&quot;-O3 -m64&quot; CXX=gcc CXXFLAGS=&quot;-O3 -m64 -felide-constructors -fno-exceptions -fno-rtti&quot; ./configure --with-raid --enable-thread-safe-client --enable-assembler&nbsp;&nbsp;--with-server-suffix =&quot; for &gt;&gt;&gt;MySQL Database of Zebra by Yhc&lt;&lt;&lt;&quot; --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench<br>
#然后根据CPU数量进行编译<br>
make -j 4 &amp;&amp; make install<br>
#添加用户<br>
groupadd mysql &amp;&amp; useradd -g mysql mysql<br>
<br>
#创建目录<br>
mkdir /usr/local/mysql/data &amp;&amp; mkdir /usr/local/mysql/run &amp;&amp; mkdir /usr/local/mysql/log &amp;&amp; mkdir /usr/local/mysql/var<br>
<br>
#更改mysql目录所有者<br>
chgrp mysql -R /usr/local/mysql &amp;&amp; chown mysql -R /usr/local/mysql<br>
<br>
#增加打开文件数量<br>
ulimit -n 4096<br>
<br>
#添加PATH<br>
echo &quot;PATH=\&quot;/usr/local/mysql/bin:\$PATH\&quot;&quot; &gt;&gt; /etc/profile &amp;&amp; export PATH=&quot;/usr/local/mysql/bin:$PATH&quot;<br>
<br>
#strip可执行文件<br>
strip /usr/local/mysql/libexec/mysqld<br>
<br>
#添加LIB PATH<br>
echo &quot;/usr/local/mysql/lib&quot; &gt;&gt; /etc/ld.so.conf &amp;&amp; ldconfig<br>
<br>
#将my.cnf文件cp到/etc目录下<br>
cp support-files/my-huge.cnf /etc/my.cnf<br>
<br>
#修改my.cnf<br>
datadir=/db/mysql<br>
#关闭binary logging<br>
#log-bin<br>
<br>
#创建数据库存放路径<br>
mkdir /db<br>
chown mysql.mysql /db -R<br>
<br>
#初始化Mysql表<br>
su - mysql -c &quot;mysql_install_db&quot;<br>
<br>
#启动服务器<br>
su - mysql -c &quot;mysqld_safe --skip-name-resolve --open-files-limit=4096&amp;&quot;<br>
<br>
#创建数据库和用户<br>
GRANT ALL PRIVILEGES ON *.* TO ztgame@'192.168.104.%' IDENTIFIED BY '' WITH GRANT OPTION;<br>
GRANT ALL PRIVILEGES ON *.* TO ztgame@'localhost' IDENTIFIED BY '' WITH GRANT OPTION;<br>
GRANT ALL PRIVILEGES ON *.* TO ztgame@'218.80.198.234' IDENTIFIED BY '' WITH GRANT OPTION;<br>
GRANT ALL PRIVILEGES ON *.* TO ztgame@'210.22.188.21' IDENTIFIED BY '' WITH GRANT OPTION;<br>
<br>
4、数据库配置<br>
用mysql进入,然后用create database dbname创建数据库。分别创建SuperServer、RecordServer、Bill数据库,然后用安装包目录下的*.sql的文件建立相应的表。(SessionServer.sql也导入到RecordServer库中)。<br>
在SuperServer数据库SERVERLIST表内添加服务器配置信息。<br>
例子:<br>
INSERT INTO `SERVERLIST` VALUES (1,1,'SuperServer','192.168.104.109',10000,'192.168.104.109',10000);<br>
INSERT INTO `SERVERLIST` VALUES(20,20,'SessionServer','192.168.104.109',6000,'192.168.104.109',6000);<br>
INSERT INTO `SERVERLIST` VALUES(21,21,'SceneServer','192.168.104.104',6010,'192.168.104.104',6010);<br>
INSERT INTO `SERVERLIST` VALUES(22,21,'SceneServer','192.168.104.105',6011,'192.168.104.105',6011);<br>
INSERT INTO `SERVERLIST` VALUES(23,21,'SceneServer','192.168.104.106',6012,'192.168.104.106',6012);<br>
INSERT INTO `SERVERLIST` VALUES(24,21,'SceneServer','192.168.104.107',6013,'192.168.104.107',6013);<br>
INSERT INTO `SERVERLIST` VALUES(25,21,'SceneServer','192.168.104.108',6014,'192.168.104.108',6014);<br>
INSERT INTO `SERVERLIST` VALUES(2200,22,'GatewayServer','192.168.104.100',6020,'210.51.23.132',6020);<br>
INSERT INTO `SERVERLIST` VALUES(2201,22,'GatewayServer','192.168.104.101',6020,'210.51.23.133',6020);<br>
INSERT INTO `SERVERLIST` VALUES(2202,22,'GatewayServer','192.168.104.102',6020,'210.51.23.134',6020);<br>
INSERT INTO `SERVERLIST` VALUES(2203,22,'GatewayServer','192.168.104.103',6020,'210.51.23.135',6020);<br>
INSERT INTO `SERVERLIST` VALUES(11,11,'RecordServer','192.168.104.109',7010,'192.168.104.109',7010);<br>
INSERT INTO `SERVERLIST` VALUES(12,12,'BillServer','192.168.104.109',7020,'192.168.104.109',7020);<br>
数据库服务器上跑SuperServer、SessionServer、RecordServer、BillServer四个服务,4个网关服务器分别跑4个网关服务,5个场景服务器分别跑5个场景服务。场景服务器对应的ID就是国家配置的ID号,这个ID号决定场景服务器上面跑几个国家。<br>
<br>
五、服务端的配置和安装<br>
1、获得安装包:<br>
release-version.tar.bz2<br>
map-version.tar.bz2<br>
在/home/ztgame下建立以时间为名字的目录(game20050928),压缩包放入此目录,然后用tar -jxvf&nbsp;&nbsp;release-version.tar.bz2 和tar -jxvf map-version.tar.bz2解开压缩包<br>
<br>
进入release目录,cp -rf ../map .<br>
按照config.xml.example格式创建文件config.xml<br>
配置文件主要定义了服务器的各种参数:<br>
这段主要定义了通用参数,如服务器本地网络设备名称,扩展网络设备名称,日志级别,SuperServer的服务器地址,端口等参数。<br>
其他各个段定义了具体的服务参数,主要是指定该服务对应的数据库,数据库的连接地址,端口,用户名,密码等数据库连接字符串。每个服务可以定义日志文件的存放位置,如果没有指定,缺省放置在/tmp/目录下面。<br>
如SuperServer服务<br>
&lt;SuperServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql&gt;mysql://test:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2514171611101365141c170b14131d0b170b1411"></a>:3306/SuperServer&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/home/test/tmp/superserver.log&lt;/logfilename&gt;<br>
&lt;/SuperServer&gt;<br>
上面配置指明SuperServer服务,采用连接串用户名test,密码123456,访问192.168.2.14服务器上3306端口下SuperServer数据库,日志文件存放在/home/test目录下。其他服务配置类似。<br>
例子:<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;<br>
&lt;!--所有各种服务器参数--&gt;<br>
&lt;Zebra&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;global&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- Specify the log level. --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;log&gt;debug&lt;/log&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- Use the specified local network device. --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;ifname&gt;eth0&lt;/ifname&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;!-- Connected to the specified supserserver, property 'port' default value is 10000. --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;superserver port=&quot;10000&quot;&gt;192.168.104.109&lt;/superserver&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/global&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;SuperServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 统一用户平台登陆服务器列表文件 --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;loginServerListFile&gt;loginServerList.xml&lt;/loginServerListFile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 角色名称唯一性验证服务器的地址 --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;RoleregServer port=&quot;9901&quot;&gt;218.80.198.252&lt;/RoleregServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 服务器信息采集的服务器地址 --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;InfoServer port=&quot;9903&quot;&gt;218.80.198.252&lt;/InfoServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql&gt;mysql://ztgame:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92ebc1a0abe5f3fae4d1dad2a3aba0bca3a4aabca3a2a6bca3a2ab"></a>:3306/SuperServer&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 如果要编码mysql连接字符串请使用工具,配置如下面的例子<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql encode=&quot;yes&quot;&gt;lmOf.1kySwS0a09j11xyCdI1ySujl1hnCvT0hDitT0hjzv00gzSv00gDSw91tS9fE1&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/superserver.log&lt;/logfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/SuperServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;RecordServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql&gt;mysql://ztgame:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="621b31505b15030a14212a22535b504c53545a4c5352564c53525b"></a>:3306/RecordServer&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/recordserver.log&lt;/logfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/RecordServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;BillServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql&gt;mysql://ztgame:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3cae0818ac4d2dbc5f0fbf3828a819d82858b9d8283879d82838a"></a>:3306/Bill&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/billserver.log&lt;/logfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/BillServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;BillClient&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 交易记录log文件路径 --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;tradelogfilename&gt;/log/clienttrade.log&lt;/tradelogfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/BillClient&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;SessionServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--MySQL database connection--&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mysql&gt;mysql://ztgame:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="275e74151e50464f51646f67161e150916111f091617130916171e"></a>:3306/RecordServer&lt;/mysql&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/sessionserver.log&lt;/logfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;dare_active_time&gt;3600&lt;/dare_active_time&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;offlineMsgPath&gt;/log/offlineMessages&lt;/offlineMsgPath&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/SessionServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;ScenesServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;sceneinfofile&gt;scenesinfo.xml&lt;/sceneinfofile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;npctradefile&gt;npctrade.xml&lt;/npctradefile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;messageSystemFile&gt;messageSystem.xml&lt;/messageSystemFile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;charinitinfoFile&gt;initcharinfo.xml&lt;/charinitinfoFile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;magicrangeFile&gt;magicrangefile.xml&lt;/magicrangeFile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;questdir&gt;quest/&lt;/questdir&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;mapdir&gt;map/&lt;/mapdir&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;tbldir&gt;map/&lt;/tbldir&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;gm_logfile&gt;/log/gm_log.log&lt;/gm_logfile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!--回写档案平率(单位是秒) --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;writebacktimer&gt;300&lt;/writebacktimer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;ossdir&gt;/log/&lt;/ossdir&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/scenesserver.log&lt;/logfilename&gt;&nbsp;&nbsp;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/ScenesServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;GatewayServer&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;!-- 国家排序方式 0:不排序 , 1:在线人数排序 , 2:注册人数排序 --&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;countryorder&gt;2&lt;/countryorder&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;logfilename&gt;/log/gatewayserver.log&lt;/logfilename&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;sceneinfofile&gt;scenesinfo.xml&lt;/sceneinfofile&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;rolereg_verify&gt;1&lt;/rolereg_verify&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;forbidWordsFile&gt;forbidWords&lt;/forbidWordsFile&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/GatewayServer&gt;<br>
&lt;/Zebra&gt;<br>
注意存放日至的目录是否建立,以及建立session服务所要求的日志存放子目录offlineMessages。<br>
<br>
修改loginServerList.xml,填入平台中心的FLServer服务器ip以及端口。<br>
例子:<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;<br>
&lt;LoginServerList&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;server ip=&quot;218.80.198.252&quot; port=&quot;7001&quot;/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;server ip=&quot;210.22.188.20&quot; port=&quot;7001&quot;/&gt; <br>
&lt;/LoginServerList&gt;<br>
<br>
然后将修改好的版本传至其它9台服务器。并启动服务<br>
<br>
<br>
六、服务器的启动,停止和更新<br>
1、将运行脚本传至各个服务器。<br>
<br>
2、开启游戏服务<br>
<br>
通过ssh使用ztgame用户远程连接至第一台网关服务器,再通过网关服务器连接其他9台服务器,<br>
<br>
10个窗口内分别进入最新的服务端存放目录/home/ztgame/game200508**/release/<br>
<br>
数据库服务器 启动服务./SuperServer -d 和 ./SessionServer -d 和 ./RecordServer -d&nbsp;&nbsp;和 ./BillServer -d<br>
场景服务器 启动服务./ScenesServer -d<br>
网关服务器 启动服务./GatewayServer -d<br>
<br>
以上操作可以通过/home/ztgame/tools/allstart game200508**来启动(由于程序是后台运行,所以如发现程序运行时间过长,可以CTRL+c中断,并不影响程序的正常运行。)<br>
<br>
<br>
3、停止游戏服务<br>
<br>
通过ssh使用ztgame用户远程连接至第一台网关服务器,运行/home/ztgame/tools/allstop,中止所有服务<br>
<br>
,此脚本是并不是强行杀进程,所以如果发现进程无法kill的情况,用/home/ztgame/tools/allstop_9来强行杀死进程。<br>
<br>
4、查看游戏服务<br>
<br>
通过ssh使用ztgame用户远程连接至第一台网关服务器,运行/home/ztgame/tools/allview,查看所有服务运行状态。<br>
<br>
5、更新游戏服务<br>
<br>
通过ssh使用ztgame用户远程连接至第一台网关服务器,再通过服务器连接其他9台服务器,<br>
<br>
分别在/home/ztgame目录下面建立最新的服务端存放目录game200508**.<br>
<br>
然后将服务器端安装包通过scp传到第一台网关服务器,在game200508**下解压。<br>
tar jxvf zebra-release-*****<br>
tar jxvf zebra-release-*****<br>
cp map release/ -rf<br>
然后从上一个版本里拷贝出一些配置文件覆盖源文件<br>
cp /home/ztgame/game_old/release/config.xml /home/ztgame/game_new/release/<br>
cp /home/ztgame/game_old/release/loginServerList.xml /home/ztgame/game_new/release/<br>
cp /home/ztgame/game_old/release/messageSystem.xml /home/ztgame/game_new/release/<br>
<br>
以上工作准备好后就可以将网关服务器上的版本传到其他服务器<br>
scp -r /home/ztgame/game_new/* <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2b8b6a5a3afa782f3fbf0ecf3f4faecf3f2f2ecf3f3f3"></a>:/home/ztgame/game_new<br>
<br>
以上操作可以通过shell脚本来实现<br>
/home/ztgame/tools/installPackage game_new game-old<br>
<br>
七、服务器数据的备份<br>
1、数据备份<br>
为了防止意外情况的发生造成数据的丢失,关键数据或整个系统或对有选择的系统部分,在本地和异地进行定时备份,以保证系统全部或部分在灾害出现时也能持续运行。<br>
2、具体方案<br>
1)、数据库每日备份<br>
&nbsp; &nbsp;每天4:00,将RecordServer数据库拷贝至/root/back后进行压缩,然后上传至192.168.1.9服务器上,/root/back留有压缩版本。<br>
&nbsp; &nbsp;运行脚本/root/scripts/back.sh<br>
例子:<br>
#!/bin/bash<br>
rm /root/back/RecordServer/* -rf<br>
/usr/local/mysql/bin/mysqlhotcopy RecordServer /root/back/RecordServer -u ztgame -p yS29wahvCH<br>
sleep 5<br>
cd /root/back<br>
tar zcf `hostname`-RecordServer`date +%Y%m%d`.tar.gz RecordServer<br>
sleep 5<br>
echo &quot;tar ok!&quot;<br>
/usr/local/bin/ncftpput -u gamebak -p gamebak@ztgame 218.80.198.234 /&nbsp;&nbsp;/root/back/`hostname`-RecordServer`date +%Y%m%d`.tar.gz<br>
sleep 20<br>
echo &quot;upload RecordServer ok!&quot;<br>
2)、数据库即时备份<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;每隔半小时,将RecordServer数据库拷贝至/root/back/hour目录进行备份,然后将压缩文件传给特定服务器。<br>
例子:<br>
#!/bin/bash<br>
hottime=`date +%Y%m%d%H%M`<br>
mkdir /root/back/hour/RecordServer&quot;$hottime&quot;<br>
/usr/local/mysql/bin/mysqlhotcopy RecordServer /root/back/hour/RecordServer&quot;$hottime&quot; -u ztgame -p yS29wahvCH<br>
sleep 5<br>
cd /root/back/hour<br>
tar zcf `hostname`-RecordServer&quot;$hottime&quot;.tar.gz RecordServer&quot;$hottime&quot;<br>
sleep 5<br>
echo &quot;tar ok!&quot;<br>
/usr/local/bin/ncftpput -u backupdb -p backupdb 192.168.102.119 /&nbsp;&nbsp;/root/back/hour/`hostname`-RecordServer&quot;$hottime&quot;.tar.gz<br>
sleep 20<br>
echo &quot;upload RecordServer ok!&quot;<br>
rm `hostname`-RecordServer&quot;$hottime&quot;.tar.gz -f<br>
3)、日志备份<br>
&nbsp; &nbsp;每天02:00,将/log/下前一天的日志,进行压缩,然后上传至192.168.1.9服务器。<br>
&nbsp; &nbsp;运行脚本/root/scripts//upload_daily<br>
例子:<br>
#!/bin/bash<br>
cd /log/<br>
mkdir log`date --date '1 days ago' +%Y%m%d`<br>
mv *.log.`date --date '1 days ago' +%y%m%d`-*&nbsp;&nbsp;log`date --date '1 days ago' +%Y%m%d`<br>
sleep 10<br>
tar zcvf `hostname`-log`date --date '1 days ago' +%Y%m%d`.tar.gz log`date --date '1 days ago' +%Y%m%d`<br>
/usr/local/bin/ncftpput -u log -p log@ztgame 218.80.198.234 /&nbsp;&nbsp;/log/`hostname`-log`date --date '1 days ago' +%Y%m%d`.tar.gz<br>
rm `hostname`-log`date --date '1 days ago' +%Y%m%d`.tar.gz<br>
<br>
注:计划任务通过/etc/crontab -e来进行设置<br>
<br>
4)、即时日志备份<br>
&nbsp; &nbsp;直接运行/home/ztgame/tools/upload 将最新日志上传至192.168.1.9服务器,方便研发部门查看。<br>
&nbsp; &nbsp;运行脚本/home/ztgame/tools/upload,(如果所有服务器的日志都需要上传,可以运行网关服务器上的/home/ztgame/tools/allupload)<br>
链接:https://pan.baidu.com/s/1nr9CO2YGlMBMd0k5a-HvxA<br>
提取码:pile<br>
<br>
页: [1]
查看完整版本: 征途源代码 - 网游单机下载 站