ET框架分布式服务器部署


前言:可能是大佬都觉得简单吧都没有详细的介绍(有介绍,可能是我太小白看不懂,哈哈哈),捉摸了一段时间把大佬们的文档记录下:

一、各服务器命名和作用(摘自:ET社区)

服务器名称

Manager : 对服务器进程进行管理Realm : 登录服务器 ( 验证账号密码 相当于LoginServer 祖传叫法,你想叫什么随你)

  • Gate : 网关服务器
  • DB : 数据库服务器
  • Location : 位置服务器
  • Map : 地图服务器
  • Client : 客户端
  • All Server: 所有服务器集合

 

各服务器的作用(摘录自文档ET框架笔记):
  • Manager:连接客户端的外网和连接内部服务器的内网,对服务器进程进行管理,自动检测和启动服务器进程。加载有内网组件NetInnerComponent,外网组件NetOuterComponent,服务器进程管理组件。自动启动突然停止运行的服务器,保证此服务器管理的其它服务器崩溃后能及时自动启动运行。
  • Realm:对Actor消息进行管理(添加、移除、分发等),连接内网和外网,对内网服务器进程进行操作,随机分配Gate服务器地址。内网组件NetInnerComponent,外网组件NetOuterComponent,Gate服务器随机分发组件。客户端登录时连接的第一个服务器,也可称为登录服务器。
  • Gate:对玩家进行管理,对Actor消息进行管理(添加、移除、分发等),连接内网和外网,对内网服务器进程进行操作,随机分配Gate服务器地址,对Actor消息进程进行管理,对玩家ID登录后的Key进行管理。加载有玩家管理组件PlayerComponent,管理登陆时联网的Key组件GateSessionKeyComponent。
  • Location:连接内网,服务器进程状态集中管理(Actor消息IP管理服务器)。加载有内网组件NetInnerComponent,服务器消息处理状态存储组件LocationComponent。对客户端的登录信息进行验证和客户端登录后连接的服务器,登录后通过此服务器进行消息互动,也可称为验证服务器。
  • Map:连接内网,对ActorMessage消息进行管理(添加、移除、分发等),对场景内现在活动物体存储管理,对内网服务器进程进行操作,对Actor消息进程进行管理,对Actor消息进行管理(添加、移除、分发等),服务器帧率管理。服务器帧率管理组件ServerFrameComponent。
  • AllServer:将以上服务器功能集中合并成一个服务器。另外增加DB连接组件DBComponent
  • Benchmark:连接内网和测试服务器承受力。加载有内网组件NetInnerComponent,服务器承受力测试组件BenchmarkComponent。

二、设置配置文件

 

 

 再命令行配置中设置各服务器的IP和端口信息,然后保存(有文档说点启动但是我点击后没有反应)

 

三、Program文件中按需求添加修改

 

 

 

三、批处理文件启动各个服务器(demo中有各个批处理文件)

@echo off
rd /q /s %cd%\Bin
rd /q /s %cd%\Output
cd %cd%/Server
dotnet publish
dotnet clean
cd %cd%/../
del /a /f %cd%\Bin\Pathfinding.Ionic.Zip.Reduced.dll

xcopy /y %cd%\Config\StartConfig\PCAllServer.txt  %cd%\Bin\
xcopy /y %cd%\Config\graph.bytes  %cd%\Bin\Config\

xcopy %cd%\Bin\*.* %cd%\Output\DB\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app1DB.bat  %cd%\Output\DB\
start /D "%cd%\Output\DB"  app1DB.bat

xcopy %cd%\Bin\*.* %cd%\Output\Realm\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app2Realm.bat  %cd%\Output\Realm\
start /D "%cd%\Output\Realm"  app2Realm.bat

xcopy %cd%\Bin\*.* %cd%\Output\Location\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app3Location.bat  %cd%\Output\Location\
start /D "%cd%\Output\Location"  app3Location.bat

xcopy %cd%\Bin\*.* %cd%\Output\Gate1\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app4Gate1.bat  %cd%\Output\Gate1\
start /D "%cd%\Output\Gate1"  app4Gate1.bat

xcopy %cd%\Bin\*.* %cd%\Output\Gate2\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app5Gate2.bat  %cd%\Output\Gate2\
start /D "%cd%\Output\Gate2"  app5Gate2.bat

xcopy %cd%\Bin\*.* %cd%\Output\Map1\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app6Map1.bat  %cd%\Output\Map1\
start /D "%cd%\Output\Map1"  app6Map1.bat

xcopy %cd%\Bin\*.* %cd%\Output\Map2\ /s /e /c /y /h /r
copy /y %cd%\Server\Bats\app7Map2.bat  %cd%\Output\Map2\
start /D "%cd%\Output\Map2"  app7Map2.bat

启动批处理文件

cd %cd%/publish
dotnet App.dll --appId=1 --appType=DB --config=../PCAllServer.txt

各个服务器的启动文件


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM