TrinityCore是支持多区配置的,即多个realm分区。只必要起一套authserver服务,负责全部区的登录。必要在mysql的auth库中到场其它realm的配置信息,如:
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12340 |
- | 2 | NewRealm | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8086 | 0 | 2 | 16 | 0 | 0 | 12340 |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
复制代码 其它realms区只必要启动worldserver服务,不必要再启动authserver服务。worldserver.conf配置文件里必要mysql指向authserver的ip,如:LoginDatabaseInfo = "192.168.1.2;3306;trinity;trinity;auth" 。这里的192.168.1.2是authserver服务器的ip地点,也就是mysql的auth库是调用的authserver的内容,而character和world数据库,照旧用各个realms当地的。
TrinityCore安装文档:TrinityCore安装记录_ubuntu 魔兽天下-CSDN博客
mysql打开网络服务文档:如安在python里登录测试mysql数据库-CSDN博客
尝试TrinityCore多区配置
- # 进入wow用户
- su - wow
- # 进入mysql控制台
- sudo mysql
复制代码 添加一条新区数据到realmlist
默认只有id 1,后来加了id 2 和6 两条。
- mysql> insert into realmlist (name) values("test") ;
- Query OK, 1 row affected (0.01 sec)
- mysql> select * from realmlist;
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | id | name | address | localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 1 | 0 | 0 | 12340 |
- | 2 | NewRealm | 192.168.1.12 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 1 | 0 | 0 | 12340 |
- | 6 | test | 127.0.0.1 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 2 | 0 | 0 | 0 | 12340 |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- 3 rows in set (0.00 sec)
复制代码
修改realm把realm id由3改为2
首先看一下:
mysql> use auth;
mysql> select id,name,address,localaddress,gamebuild from realmlist;
+----+----------+-----------------+--------------+-----------+
| id | name | address | localaddress | gamebuild |
+----+----------+-----------------+--------------+-----------+
| 1 | Trinity | 114.115.136.249 | 192.168.0.12 | 12340 |
| 3 | NewRealm | 192.168.1.12 | 192.168.1.12 | 12345 |
+----+----------+-----------------+--------------+-----------+
2 rows in set (0.00 sec)
把realm名字改成:NewRealm 。固然可以改成自己喜欢的名字。
刚开始拿到的id是3,把RealmID 从3改成2:
- mysql> update realmlist set id="2" where id="3";
- Query OK, 1 row affected (0.01 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
复制代码 worldserver.conf文件中修改
修改realm2区服务器的server/etc/worldserver.conf文件,把原文件中RealmID = 1 改为RealmID = 2
同样在authserver.conf文件中必要写
当时是这样的:
- 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 * from realmlist;
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | id | name | address | localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 192.168.0.12 | 255.255.255.0 | 8085 | 0 | 0 | 1 | 0 | 0 | 12340 |
- | 3 | NewRealm | 192.168.1.12 | 192.168.1.12 | 255.255.255.0 | 8085 | 0 | 0 | 0 | 0 | 0 | 12345 |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- 2 rows in set (0.00 sec)
复制代码
修改时区到16
- timezone displayed name timezone displayed name
- 1 Development 20 CN4
- 2 United States 21 CN5
- 3 Oceanic 22 CN6
- 4 Latin America 23 CN7
- 5 Tournament 24 CN8
- 6 Korea 25 Tournament
- 7 Tournament 26 Test Server
- 8 English 27 Tournament
- 9 German 28 QA Server
- 10 French 29 CN9
- 11 Spanish 30 Test Server 2
- 12 Russian 31 CN10
- 13 Tournament 32 CTC
- 14 Taiwan 33 CNC
- 15 Tournament 34 CN1/4
- 16 China 35 CN2/6/9
- 17 CN1 36 CN3/7
- 18 CN2 37 CN5/8
- 19 CN3
复制代码 把时区修改成16 中国
- mysql> UPDATE realmlist SET timezone='16' WHERE id =3 ;
- Query OK, 1 row affected (0.03 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> UPDATE realmlist SET timezone='16' WHERE id =1 ;
- Query OK, 1 row affected (0.02 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> select * from realmlist;
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | id | name | address | localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 192.168.0.12 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12340 |
- | 3 | NewRealm | 192.168.1.12 | 192.168.1.12 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12345 |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- 2 rows in set (0.01 sec)
复制代码 但是现在登录到192.168.0.12,照旧看不到多区。
现在总结一下,必要id 修改一下,比如把id改成2 ,同时worldserver.conf 文件里的 realmID 也设置为2
同时localAddress 不能用当地ip地点,如192.168.0.12 ,因为这样远端(通过公网)就无法连上服务器了。
解决看不到TrinityCore多区的题目
原来是版本的题目,以前用的版本是12340,后来编译的时间可能拿到的是12345,就是版本不一致导致客户端不停没有瞥见新区
- mysql> update realmlist set gamebuild="12340" where id="2";
复制代码- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12340 |
- | 2 | NewRealm | 192.168.1.12 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12340 |
- +----+----------+-----------------+--------------+-----------------+------+------
复制代码
将RealmID改成1和2,将版本号都改成12340,现在终于能看到两个区了。
现在的题目是,假如账户登录的是1号realm(192.168.0.12),能瞥见两个区,但是只能登录1号区,登录2号区提示auth认证失败,进不去瞥见账户那里。
假如帐号登录的就是2号realm(192.168.1.12),那么登录1号区会失败,2号可以登录。
也就是无法1号和2号两个区同时登录乐成。
核心:解决全网可通mysql auth数据库的题目
现在的核心就是要设置一个公用的mysql的auth库,并保证可以通过网络能连上这个库。
决定利用192.168.0.12为公用auth库,realm1 和realm2都指向这台服务器的mysql数据库。为了可以或许外网访问mysql,增加了一个host为%的语句:
- mysql> use mysql
- 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> update auth set host = '%' where user = 'trinity';
- ERROR 1146 (42S02): Table 'mysql.auth' doesn't exist
- mysql> update user set host = '%' where user = 'trinity';
- Query OK, 1 row affected (0.01 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> select host, user from user;
- +-----------+------------------+
- | host | user |
- +-----------+------------------+
- | % | trinity |
- | localhost | debian-sys-maint |
- | localhost | mysql.infoschema |
- | localhost | mysql.session |
- | localhost | mysql.sys |
- | localhost | root |
- +-----------+------------------+
- 6 rows in set (0.00 sec)
复制代码 现在调试,从192.168.1.12登过来,显示
Error: (1130, "Host '192.168.1.12' is not allowed to connect to this MySQL server")
发现是给错服务器了.....因为两台服务器,老是弄混.....
给192.168.0.12增加源ip192.168.1.12的登入权限:
-
- CREATE USER 'trinity'@'192.168.1.12' IDENTIFIED BY 'trinity';
- GRANT ALL PRIVILEGES ON auth.* TO 'trinity'@'192.168.1.12' WITH GRANT OPTION;
复制代码 可以看到加进去了:
- select host, user from user;
- +--------------+------------------+
- | host | user |
- +--------------+------------------+
- | 192.168.1.12 | trinity |
- | localhost | debian-sys-maint |
- | localhost | mysql.infoschema |
- | localhost | mysql.session |
- | localhost | mysql.sys |
- | localhost | phpmyadmin |
- | localhost | root |
- | localhost | trinity |
- +--------------+------------------+
- 9 rows in set (0.00 sec)
复制代码 再配好worldserver的配置
worldserver从网上过来,假如是当地登录,设为当地192.168.1.12地点即可。
这里用了公网的ip的映射,最终auth realmlist的配置:
- mysql> update realmlist set address="114.115.136.249" where id="2";Query OK, 1 row affected (0.03 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> update realmlist set port="8086" where id="2";Query OK, 1 row affected (0.02 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> update realmlist set timezone="16" where id="2";Query OK, 1 row affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> select * ;ERROR 1096 (HY000): No tables usedmysql> select * from auth;ERROR 1146 (42S02): Table 'auth.auth' doesn't existmysql> select * from realmlist;+----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+| id | name | address | localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |+----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- | 1 | Trinity | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8085 | 0 | 0 | 16 | 0 | 0 | 12340 |
- | 2 | NewRealm | 114.115.136.249 | 127.0.0.1 | 255.255.255.0 | 8086 | 0 | 2 | 16 | 0 | 0 | 12340 |
- +----+----------+-----------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
- 2 rows in set (0.00 sec)
复制代码 这样终于多区配置乐成了!两个区 Trinity和NewRealm都可以登录了!
总结
TrinityCore多区拓扑:
可以看到两个分区是差别网段,192.168.0.12和192.168.1.12且中心有一层NAT。内网的192.168.0.12被NAT为192.168.1.2 。
实在这不是必须的,在同一网段,大概不在同一网段,都可以实现TrinityCore的多区设置。固然有一个条件,就是其它的ream必要可以或许跟auth服务器的mysql通信,因为其它realm都是登入auth所在的mysql数据库并调用的此中的auth库内容。
对于所有的realms,都要设定auth指向192.168.0.12即worldserver.conf文件中设置,即多个realm认证服务用同一个数据库:
- # LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth"
- LoginDatabaseInfo = "192.168.1.2;3306;trinity;trinity;auth"
复制代码 这里192.168.0.12数据库被NAT为192.168.1.2:3306 。所以最终指向了192.168.1.2 ,留意必要设置mysql支持网络登录,具体见:https://skywalk.blog.csdn.net/article/details/140786611
固然realm1 照旧利用127.0.0.1地点登录myql,即:
- LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth"
复制代码
对于realmid,每个realm对必要跟auth数据库中的id值对应,比如这里
192.168.0.12 是realm 1, worldserver.conf中设为RealmID = 1:
192.168.1.12是realm2 ,设为RealmID = 2
假如再增加ream,则id依次增加即可。
worldserver.conf中RealmZone 是realm的分区,设为16即为cn ,默认是RealmZone = 1
末了留意gamebuild必要与客户端版本一致,否则客户端是看不到服务器的。
这样设置好后,TrinityCore多区realms就设定好了。当前还不支持跨服副本(Cross realms are not supported.)
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |