备份和镜像TrinityCore

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

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

首先备份数据:

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

备份文件

sql 复制代码
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到服务器:

sql 复制代码
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库也需要进行相应修改。最终就是三个库一起导入:

导入备份的三个文件:

sql 复制代码
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

sql 复制代码
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参数

sql 复制代码
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

sql 复制代码
git clone --depth 1 -b 3.3.5 https://github.com/TrinityCore/TrinityCore

发现延时异常大

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

相关推荐
真真-真真12 分钟前
WebXR
linux·运维·服务器
轩辰~34 分钟前
网络协议入门
linux·服务器·开发语言·网络·arm开发·c++·网络协议
wanhengidc1 小时前
短视频运营行业该如何选择服务器?
运维·服务器
雨中rain1 小时前
Linux -- 从抢票逻辑理解线程互斥
linux·运维·c++
-KamMinG2 小时前
Centos7.9安装openldap+phpldapadmin+grafana配置LDAP登录最详细步骤 亲测100%能行
运维·grafana
Bessssss2 小时前
centos日志管理,xiao整理
linux·运维·centos
s_yellowfish2 小时前
Linux服务器pm2 运行chatgpt-on-wechat,搭建微信群ai机器人
linux·服务器·chatgpt
豆是浪个2 小时前
Linux(Centos 7.6)yum源配置
linux·运维·centos
vvw&2 小时前
如何在 Ubuntu 22.04 上安装 Ansible 教程
linux·运维·服务器·ubuntu·开源·ansible·devops
我一定会有钱2 小时前
【linux】NFS实验
linux·服务器