备份和镜像TrinityCore

相比重新安装,省去了编译的过程,同时还能保留以前的人物、装备等。

注意,若不想重新编译安装,则需要创建一样的目录、账户等,以减少不必要的麻烦。

首先备份数据:

mysql备份和导入方法见:使用dump备份mysql数据库-CSDN博客

备份文件

mysqldump -u trinity -ptrinity auth > auth.sql
 
mysqldump -u trinity -ptrinity world > world.sql
 
mysqldump -u trinity -ptrinity characters > characters.sql

备份的时候会有警告和报错:'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation'  ,不用去管它。

将备份文件scp到服务器:

scp *.sql 192.168.1.12:/home/wow


准备导入数据库。

数据库导入

导入之前,需要导入一个“创建数据库”的sql

只需要导入这一个,后面其它数据库会自动导入

To create the MySQL databases needed by Trinity, you need to execute one of the following MySQL queries with your mysql client:

或者到项目TrinityCore/sql/create目录也能获取该文件,该文件内容:

CREATE USER 'trinity'@'localhost' IDENTIFIED BY 'trinity' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;

GRANT USAGE ON * . * TO 'trinity'@'localhost';

CREATE DATABASE `world` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE DATABASE `characters` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE DATABASE `auth` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

GRANT ALL PRIVILEGES ON `world` . * TO 'trinity'@'localhost' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON `characters` . * TO 'trinity'@'localhost' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON `auth` . * TO 'trinity'@'localhost' WITH GRANT OPTION;

下载之后,进入mysql,然后导入:

source  create_mysql.sql

这时候一套新的TrinityCore服务已经安装好了。如果这时候执行下一步同步TrinityCore文件并启动authserver和worldserver,就是全新环境。启动之后再导入auth和characters两个库,理论上就能恢复当前游戏环境和账户等。但是因为加入了TrinityBot功能,所以world库也需要进行相应修改。最终就是三个库一起导入:

导入备份的三个文件:

sudo mysql
 
use auth;
 
source auth.sql
 
use world
 
source world.sql
 
use characters
 
source characters.sql

 

 同步TrinityCore文件

直接把server目录全部cp到新机器的相同目录:

scp -r server 192.168.1.12:/home/wow/scp -R server 192.168.1.12:/home/wow/

修改服务器地址

因为换了机器,所以要修改auth里面的address地址,修改成192.168.1.12

mysql> use auth;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select id,name,address,localaddress,gamebuild from realmlist;
+----+---------+-----------------+--------------+-----------+
| id | name    | address         | localaddress | gamebuild |
+----+---------+-----------------+--------------+-----------+
|  1 | Trinity | 114.115.136.249 | 127.0.0.1    |     12340 |
+----+---------+-----------------+--------------+-----------+
1 row in set (0.01 sec)

mysql> UPDATE realmlist SET address = '192.168.1.12' WHERE address = '114.115.136.249';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select id,name,address,localaddress,gamebuild from realmlist;
+----+---------+--------------+--------------+-----------+
| id | name    | address      | localaddress | gamebuild |
+----+---------+--------------+--------------+-----------+
|  1 | Trinity | 192.168.1.12 | 127.0.0.1    |     12340 |
+----+---------+--------------+--------------+-----------+
1 row in set (0.00 sec)

下载官方源码

启动server/bin/worldserver 之后报错:DBUpdater: The given source directory /home/wow/TrinityCore does not exist 。原来还是需要官方的源码,并要放在以前编译的时候的目录位置。也就是wow账户的TrinityCore目录。另外现在git clone默认拉下来的是wow最新版,我们采用的是3.3.5版本,这样git clone需要带上-b 3.3.5参数

git clone --depth 1 -b 3.3.5 https://github.com/TrinityCore/TrinityCore

好了,到了这里,服务器就完全镜像过来了!新的一台服务器就装好了。

这时候先执行server/bin/authserver ,然后再执行server/bin/worldserver ,整个服务就起来了!

 调试

启动worldserver报错

Updating Auth database...
DBUpdater: The given source directory /home/wow/TrinityCore does not exist, change the path to the directory where your sql directory exists (for example c:\source\trinitycore). Shutting down.
Could not update the Login database, see log for details.

下载官方源码:

git clone --depth 1 https://github.com/TrinityCore/TrinityCore


启动worldserver 报错ERROR 1054 (42S22) at line 2 in file:

>> The file '2020_12_15_00_characters.sql' was applied to the database, but is missing in your update directory now!
Cleanup is disabled! There were  86 dirty files applied to your database, but they are now missing in your source directory!
>> Applied 1 query. Containing 1 new and 85 archived updates.
Updating World database...
DBUpdater: Given update include directory "/home/wow/TrinityCore/sql/old/3.3.5a/world" does not exist, skipped!
>> Applying update "2024_05_11_12_world.sql" '478F5B6'...
mysql: [Warning] Using a password on the command line interface can be insecure.
>> Reapplying update "2024_05_12_00_world.sql" 'D86B392' -> '1175592' (it changed)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1054 (42S22) at line 2 in file: '/home/wow/TrinityCore/sql/updates/world/master/2024_05_12_00_world.sql': Unknown column 'PhaseId' in 'field list'
Applying of file '/home/wow/TrinityCore/sql/updates/world/master/2024_05_12_00_world.sql' to database 'world' failed! If you are a user, please pull the latest revision from the repository. Also make sure you have not applied any of the databases with your sql client. You cannot use auto-update system and import sql files from TrinityCore repository with your sql client. If you are a developer, please fix your sql query.
Could not update the World database, see log for details.
看了下:master = 10.2.7.55165, 3.3.5 = 3.3.5a.12340, wotlk_classic = 3.4.3.54261, cata classic = 4.4.0.55141

原来这是分支没弄对。

切换到3.3.5分支:

git checkout 3.3.5
没切成,重新git clone

git clone --depth 1 -b 3.3.5 https://github.com/TrinityCore/TrinityCore

发现延时异常大

演示472ms,这也太大了,怎么回事呢 ? 有的号延时1ms,真是弄不懂了...

  • 30
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值