kbengine启动设置(转)-编译的坑

Build · Docs · KBEngine

linux环境

linux vi显示行号:vi xx :set nu

yum install openssl-devel (在Ubuntu类系统上, 使用 "apt-get install libssl-dev
")
yum install mysql-server (在Ubuntu类系统上, 使用 "apt-get install mysql-server")
yum install mysql-devel (在Ubuntu类系统上, 使用 "apt-get install libmysqld
-dev")
cd kbengine/kbe/src
chmod -R 755 .
make

ubuntu
apt-get install libssl-dev
apt-get install build-essential
apt-get install autoconf libtool libsysfs-dev pkg-config
apt-get install mysqld-server libmysqld-dev
apt-get install libmysql++-dev

会报错缺少g++,后续有报automake版本太低,gnu libtoolize版本太低

yum -y install gcc gcc-c++ autoconf automake make libtool

db_interface_mysql.h:14:25: 致命错误:mysql/mysql.h:没有那个文件或目录

apt-get install libmysql++-dev 解决
或者
yum install mysql-devel
yum install mysql-server

数据库

mysql> grant all privileges on *.* to kbe@'%' identified by 'pwd123456';
	mysql> grant select,insert,update,delete,create,drop on *.* to kbe@'%' identified by 'pwd123456';
	mysql> FLUSH PRIVILEGES;

	在CMD中测试一下是否能使用这个账号登陆Mysql(请注意默认Mysql端口为3306, 如不一致请修改
	kbengine_defaults.xml->dbmgr
-><port>330x</port>)。

	另外请不要使用其他任何第三方工具来测试,必须使用mysql进行测试,第三方工具为了能够正确的连接到
	Mysql可能会采用一些兼容的方式,但这对于游戏服务端来说是不可靠的方式,权限应该由用户明确的设置。

	进入你的mysql安装目录
找到mysql.exe所在目录, 然后cmd进入这个目录中执行如下语句:
	(如果没有提示错误则账号配置完毕,有错误请google)

	Windows:
		进入你的mysql安装目录找到mysql.exe, 然后在CMD执行如下命令:
		C:\mysql\bin> mysql -ukbe -ppwd123456 -hlocalhost -P3306

	Linux:
		[root@localhost ~] mysql -ukbe -ppwd123456 -hlocalhost -P3306

然后rpc/rpc.h missing

sudo yum -y install libtirpc-devel

修改 /kbengine/kbe/src/build/common.mak

common.mak

:526:Hybrid64/client_interface.o] 错误 1-报错不管,重新执行make

其中cd client_lib

&& make all编译要等1小时--g++编译最好要挑个时间一边编译一边做其他的。

disk bps read:超到100m/s上限。ssh以及Http服务都被迫终止。

g++: internal compiler error: Killed (program cc1plus):内存不够,升级服务器内存。。

snprintf

’ output 109 or more bytes (assuming 65643) into a destination of size 65535

vi跳到某一行:+xx

文件路径/src/lib/db_mysql/entity_table_mysql.cpp

内存不够,g++: internal compiler error: Killed (program cc1plus) 解决办法

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile
报错:mkswap: /swapfile:不安全的权限 0644,建议使用 0600。
swapon: /swapfile:不安全的权限 0644,建议使用 0600。
sudo chmod 600 /swapfile

ssh连接长时间不操作断开client_loop: send disconnect: Broken pipe

vi /etc/ssh/ssh_config

加两句
Host *
IPQoS=throughput

systemctl restart sshd

从0点开始:

跑了8小时最后又出来这个

client_loop: send disconnect: Broken pipe。。真坑。。试试这个方案(转) 解决ssh的"Write failed: Broken pipe"问题-阿里云开发者社区,晚上试试这个..

方法一:如果您有多台服务器,不想在每台服务器上设置,只需在客户端
的 ~/.ssh/ 文件夹中添加 config 文件,并添加下面的配置:
ServerAliveInterval 60

方法二:如果您有多个人管理服务器,不想在每个客户端进行设置,只需在服务器的 /etc/ssh/sshd_config
 中添加如下的配置:
ClientAliveInterval 60

方法三:如果您只想让当前的 ssh 保持连接,可以使用以下的命令:
ssh -o ServerAliveInterval=60 user@sshserver

清空错误

make clean

最后还是不行,只能提issue了。。

issues没后续,只能自己慢慢排查里,又发现个问题libpython3.7m.a

cd kbengine/src/lib/python
./configure
make
make install

报错ModuleNotFoundError: No module named '_ctypes

',去python官网下了3.7替换试试。。

python下载得点这里,好坑。。

服务器开启ftp:service vsftpd start

解压.tgz文件

gunzip filename.tgz
tar -xvf filename.tar

rm -rf项目,重头开始试试。。

又挂在内存溢出sudo swapon --show查看交换区信息。试试stackoverflow的

make -j 8 g++: internal compiler error: Killed (program cc1plus)

sudo dd if=/dev/zero of=/swapfile bs=64M count=1048576
dd: 写入'/swapfile' 出错: 设备上没有空间
count=512 //是上限了
sudo chmod 600 /swapfile
sudo mkswap /swapfile

sudo swapon /swapfile

报新的错误collect2: 错误:ld 返回 1,网上搜到的。没看到哪里的错误。

编译成功后关闭swap

sudo swapoff /swapfile
sudo rm /swapfile

换个tar.gz包试试,解压

tar -zxvf 压缩文件名.tar.gz

还是报错内存不足,用make -j 1

试试,报错磁盘空间满了。。再换个试试。。

服务器升级到2核4G总算可以了。

 

官方资源文件里的python有问题,编译会报错,去官方下个3.7的替换掉,编译后在kbe/bin/server目录下生成kbcmd可执行文件。

修改kbengine-xxx目录名为kbengine,运行new_assets.sh后生成server_assets目录。

make是编译,原先bin/server目录没东西,编译成功后就有了

dbmgr服务器

启动不起来,没报错,也没提示,暂时看不出哪里的问题

issue里搜了下,很多人也有这个问题。。

gdb可以查看core日志

这里讨论的很激烈

 

我用gdb

调试core文件看到openssl

的问题。。

试试这里:

官方说这里的问题:

官方给的解决方式:

不靠谱,网上搜了下这个试试Kbengine游戏引擎-【1】kbengine安装 - 江湖一浪子 - 博客园

root @ localhost ~]# wget -c https://github.com/kbengine/kbengine/archive/v1.0.0.zip
root @ localhost ~]# unzip v1.0.0.zip
[root @ localhost ~]# cd kbengine/kbe/src
[root @ localhost/ src]# chmod
 -R 755 .
[root @ localhost/ src]# make

这个会报错rpc缺失以及其他错误,也不靠谱

试试换个kb版本。。

又报错:这次是log4

log4cxx: setFile(logs/machine.log,true) call failed.
log4cxx
: IO Exception : status code = 2
log4cxx: setFile(logs/packets/machine.packets.log,true) call failed.
log4cxx: IO Exception : status code = 2
log4cxx: No output stream or file set for the appender named [R].

centos 8

被官方弃用了,系统换成7.5,还不行,换成ubundu 18

可行

 

启动成功后:

日志:

baseapp

INFO root [0x7fa5433cff80] [2023-01-16 17:07:10,338] - ---- baseapp is running ----
 DEBUG root [0x7fa5433cff80] [2023-01-16 17:07:10,338] - Components::process(): Request for the process of identity...
  WARN root [0x7fa5433cff80] [2023-01-16 17:07:16,343] - EntityApp::checkTickPeriod: tick took 6004% (6.00 seconds)!

baseappmgr

 INFO root [2023-01-16 17:07:11,451] - ---- baseappmgr
 is running ----
 DEBUG root [2023-01-16 17:07:11,452] - Components::process(): Request for the process of identity...
  INFO root [2023-01-16 17:07:18,487] - Components::findComponents: find logger(1)...
  INFO root [2023-01-16 17:07:18,554] - Components::findComponents: found logger, addr:172.25.111.229:46223
  INFO root [2023-01-16 17:07:18,554] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:18,554] - Components::addComponent[logger], uid=27699, componentID=1129653375331859700, globalorderid=1, grouporderid
=1, totalcount=1
  INFO root [2023-01-16 17:07:18,554] - Components::findComponents: find dbmgr(2)...
  INFO root [2023-01-16 17:07:18,655] - Components::findComponents: found dbmgr, addr:172.25.111.229:56151
  INFO root [2023-01-16 17:07:18,655] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:18,655] - Components::addComponent[dbmgr], uid=27699, componentID=3129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  WARN root [2023-01-16 17:07:19,655] - Forwarding logs to logger[172.25.111.229:46223/0/0/0]...

cellapp

INFO root [0x7f68a04c6f80
] [2023-01-16 17:07:11,532] - ---- cellapp is running ----
 DEBUG root [0x7f68a04c6f80] [2023-01-16 17:07:11,532] - Components::process(): Request for the process of identity...
  WARN root [0x7f68a04c6f80] [2023-01-16 17:07:17,538] - EntityApp::checkTickPeriod: tick took 6006% (6.01 seconds)!
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,633] - Components::findComponents: find logger(1)...
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,655] - Components::findComponents: found logger, addr:172.25.111.229:46223
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,655] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,655] - Components::addComponent[logger], uid=27699, componentID=1129653375331859700, globalorderid=1, grouporderid=1, totalcount=1
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,655] - Components::findComponents: find dbmgr(2)...
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,755] - Components::findComponents: found dbmgr, addr:172.25.111.229:56151
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,755] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [0x7f68a04c6f80] [2023-01-16 17:07:18,755] - Components::addComponent[dbmgr], uid=27699, componentID=3129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  WARN root [0x7f68a04c6f80] [2023-01-16 17:07:19,756] - EntityApp::checkTickPeriod: tick took 1223% (1.22 seconds)!
  WARN root [0x7f68a04c6f80] [2023-01-16 17:07:19,756] - Forwarding logs to logger[172.25.111.229:46223/0/0/0]...

cellappmgr

INFO root [2023-01-16 17:07:10,277] - ---- cellappmgr
 is running ----
 DEBUG root [2023-01-16 17:07:10,277] - Components::process(): Request for the process of identity...
  INFO root [2023-01-16 17:07:17,304] - Components::findComponents: find logger(1)...
  INFO root [2023-01-16 17:07:17,352] - Components::findComponents: found logger, addr:172.25.111.229:46223
  INFO root [2023-01-16 17:07:17,352] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:17,352] - Components::addComponent[logger], uid=27699, componentID=1129653375331859700, globalorderid=1, grouporderid=1, totalcount=1
  INFO root [2023-01-16 17:07:17,352] - Components::findComponents: find dbmgr(2)...
  INFO root [2023-01-16 17:07:17,453] - Components::findComponents: found dbmgr, addr:172.25.111.229:56151
  INFO root [2023-01-16 17:07:17,453] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:17,453] - Components::addComponent[dbmgr], uid=27699, componentID=3129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  WARN root [2023-01-16 17:07:18,453] - Forwarding logs to logger[172.25.111.229:46223/0/0/0]...

dbmgr

INFO root [2023-01-16 17:07:10,498] - ---- dbmgr is running ----
 DEBUG root [2023-01-16 17:07:10,498] - Components::process(): Request for the process of identity...
  INFO root [2023-01-16 17:07:16,504] - ServerApp::onRegisterNewApp: uid:27699, username:root, componentType:interfaces, componentID:1129652375332859700, globalorderID=-1, grouporderID=-1, intaddr:172.25.111.229, intport:30099, extaddr
:nonsupport, extport:0,  from 127.0.0.1:30099/0/0/0.
  INFO root [2023-01-16 17:07:16,504] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:16,504] - Components::addComponent[interfaces], uid=27699, componentID=1129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  INFO root [2023-01-16 17:07:17,510] - Components::findComponents: find logger(1)...
  INFO root [2023-01-16 17:07:17,553] - Components::findComponents: found logger, addr:172.25.111.229:46223
  INFO root [2023-01-16 17:07:17,553] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:17,553] - Components::addComponent[logger], uid=27699, componentID=1129653375331859700, globalorderid=1, grouporderid=1, totalcount=1
  WARN root [2023-01-16 17:07:17,553] - Forwarding logs to logger[172.25.111.229:46223/0/0/0]...

interfaces

INFO root [2023-01-16 17:07:09,984] - ---- interfaces is running ----
 DEBUG root [2023-01-16 17:07:09,985] - Components::process(): Request for the process of identity...
  INFO root [2023-01-16 17:07:15,991] - ServerApp::onRegisterNewApp: uid:27699, username:root, componentType:dbmgr, componentID:3129652375332859700, globalorderID=-1, grouporderID=-1, intaddr:172.25.111.229, intport:56151, extaddr:nonsupport, extport:0,  from 127.0.0.1:41870/0/0/0.
  INFO root [2023-01-16 17:07:15,991] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:15,991] - Components::addComponent[dbmgr], uid=27699, componentID=3129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  INFO root [2023-01-16 17:07:17,078] - Components::process(): Found all the components!

logger_baseapp

INFO    baseapp01 27699 6129652375332859700  [2023-01-16 17:07:45 438] - EntityApp::createEntity: new SpawnPoint 173
    INFO    baseapp01 27699 6129652375332859700  [2023-01-16 17:07:45 539] - EntityApp::createEntity: new SpawnPoint 174

logger_baseappmgr

INFO baseappmgr-1 27699 4129652375332859700  [2023-01-16 17:07:25 133] - Components::addComponent[cellapp], uid=27699, componentID=7129652375332859700, globalorderid=5, grouporderid=1, totalcount=1
    INFO baseappmgr-1 27699 4129652375332859700  [2023-01-16 17:07:39 039] - Baseappmgr::onBaseappInitProgress: cid=6129652375332859700, progress=1.
    INFO baseappmgr-1 27699 4129652375332859700  [2023-01-16 17:07:39 039] - Baseappmgr::onBaseappInitProgress: all completed!

logger_cellapp

S_INFO    cellapp01 27699 7129652375332859700  [2023-01-16 17:07:47 232] - Monster::addTerritory: 2164 range=15, id=1.
  S_INFO    cellapp01 27699 7129652375332859700  [2023-01-16 17:07:47 433] - Monster::addTerritory: 2166 range
=15, id=1.

logger_cellappmgr

DEBUG cellappmgr-1
 27699 5129652375332859700  [2023-01-16 17:07:39 039] - Cellappmgr::reqCreateCellEntityInNewSpace: entityType=Space, entityID=88, componentID=6129652375332859700, cellapp
(cid=7129652375332859700, load=0.177921, numEntities=158).
    INFO cellappmgr-1 27699 5129652375332859700  [2023-01-16 17:08:21 625] - ServerApp::onChannelTimeOut: Channel 172.25.111.229:50139/0/0/0 timeout!

logger_dbmgr

INFO      dbmgr-1 27699 3129652375332859700  [2023-01-16 17:07:38 039] - GlobalDataServer::broadcastDataChanged: writer(cellapp, addr=172.25.111.229:55932/0/0/0), keySize=13, valSize=62, isDelete=0
    INFO      dbmgr-1 27699 3129652375332859700  [2023-01-16 17:07:39 039] - GlobalDataServer::broadcastDataChanged: writer(cellapp, addr=172.25.111.229:55932/0/0/0), keySize=13, valSize=62, isDelete=0

logger.log

INFO [0x7fcdef559f80] [2023-01-16 17:07:18,655] - ServerApp::onRegisterNewApp: uid:27699, username:root, componentType:cellapp, componentID:7129652375332859700, globalorderID=-1, grouporderID=-1, intaddr:172.25.111.229, intport:35069, extaddr:nonsupport, extport:0,  from 172.25.111.229:36476/0/0/0.
  INFO [0x7fcdef559f80] [2023-01-16 17:07:18,655] - Components::addComponent[cellapp], uid=27699, componentID=7129652375332859700, globalorderid=6, grouporderid=1, totalcount=1

logger_loginapp

INFO   loginapp01 27699 8129652375332859700  [2023-01-16 17:07:29 352] - HTTPCBHandler::bind: 172.25.111.229:21103
 WARNING   loginapp01 27699 8129652375332859700  [2023-01-16 17:07:29 352] - channel.cpp:1023: Profile processRecvMessages took 1.20 seconds
    INFO   loginapp01 27699 8129652375332859700  [2023-01-16 17:07:39 039] - Loginapp::onBaseappInitProgress: progress=1.

loginapp

INFO root [2023-01-16 17:07:18,655] - Components::findComponents: found dbmgr, addr:172.25.111.229:56151
  INFO root [2023-01-16 17:07:18,655] - Components::addComponent: reset orderLog, uid=27699!
  INFO root [2023-01-16 17:07:18,655] - Components::addComponent[dbmgr], uid=27699, componentID=3129652375332859700, globalorderid=1, grouporderid=1, totalcount=1
  WARN root [2023-01-16 17:07:19,655] - Forwarding logs to logger[172.25.111.229:46223/0/0/0]...

machine.log

INFO root [2023-01-16 17:08:29,240] - ServerApp::onChannelTimeOut: Channel 172.25.111.229:33149/0/0/0 timeout!
  INFO root [2023-01-16 17:08:29,540] - ServerApp::onChannelTimeOut: Channel 172.25.111.229:40605/0/0/0 timeout!

mysql数据库表,kbe下生成数据表成功

表中数据是空的。

注册失败后日志

baseapp

 ERROR root [0x7fa5433cff80] [2023-01-16 17:22:53,795] - PacketReader::processMessages: not found msgID=2, msglen=38, from 120.236.231.2:56009/0/0/0.

baseappmgr

cellapp

cellappmgr

dbmgr

interfaces

logger_baseapp

ERROR    baseapp01 27699 6129652375332859700  [2023-01-16 17:22:53 795] - PacketReader::processMessages: not found msgID=2, msglen=38, from 120.236.231.2:56009/0/0/0.

logger_baseappmgr

logger_cellapp

logger_cellappmgr

logger_dbmgr

logger.log

logger_loginapp

loginapp

machine.log

 

注册的时候msgid=2,登陆的时候msgid=4都被判定为not found

FAQ · Docs · KBEngine

windows 服务器的话,mysql需要降低到5.7版本。。

 

正常运行的项目重新编译报错

make[2]: *** No rule to make target 
'/xx/kbengine-2.5.12/kbe/src/lib/dependencies/fmt/include/fmt/format-inl.h', 
needed by 'Hybrid64/format.o'.  Stop.
这时候改名成了kbengine,重新改名成kbengine-2.5.12即可

 

https://zhuanlan.zhihu.com/p/570978695

posted on 2024-09-11 12:24  混元真人  阅读(85)  评论(0)    收藏  举报