TARS Registry 1 Registry 2 Registry N Web
TARS
主控节点(热备) Registry 1 Registry 2 Registry. N 运维管理平台 Web 管理服务 Node 1 服 务 节 点 Server 1 172. 16. 28. 153 Server 2 Admin. Registry Server. N 异常信息 Notify 指标统计 …… Node. N Server 1 Stat 172. 16. 28. 154 Server 2 Log Server. N Patch Config 业务Server Property 远程LOG 发布平台 配置中心 业务信息上报
服务主要交互流程 Admin Registry web patch registry patch string. To. Proxy(“Pet. Obj”); sync/async petsvr keep alive node 1 report status client tcp/udp stat petsvr log prop admin notify node 2 config admin command
后台代码结构(C++) 公共服务 registry node patch tars 2 cpp tars 2 java tars 2 objectc tars 2 node …. 框架/ 具 log config Application Communicator (conf/log/notify) (stat/property) libserver tars protocol 基础类库 base class tools 框架 具 stat notify libservant libparse 服务 property 公共 协议 组件 jmem
TARS协议 tag 可选字段 必选字段 序列化 Jce. Output. Stream<Buffer. Writer> os; ti. write. To(os); 反序列化 Jce. Input. Stream<Buffer. Reader> is; is. set. Buffer(os. get. Buffer(), os. get. Length()); tii. read. From(is);
代码自动生成 tars 文件 tars 2 cpp 客户端 /usr/local/tars/cpp/tools/tars 2 cpp Pay. tars 服务端
客户端与服务端结构(多线程模型) tcp udp Net. Thread Adapter. Proxy Async MQ call (obj) timeout back Servant. Proxy tcp udp Net. Thread Adapter (MQ) over load Servant Handle Admin Servant. Imp Async client invoke server app
服务模型(C++)—— accept Epoll. Server Bind. Adapter(ip: port) conn(index) Net. Thread sbuffer rbuffer Handle. Thread(1~m)
问题定位 主要目录 1. 框架服务目录: /usr/local/app/tars/xxx 2. 业务服务: /usr/local/app/tarsnode/data/ 3. 服务日志: /usr/local /app/tars/app_log/xxxserver/*. log 4. Web日志: /usr/local/app/web/log
GITHUB——目录结构 https: //github. com/Tars. Cloud/Tars 教程文档: https: //tarscloud. github. io/Tars. Docs/ 目� �明 cpp c++源� framework 核心框架服�源� , 依� cpp go Go源� Java源� nodejs Nodejs源� php Php源� tup Tup��源� (https: //tarscloud. github. io/Tars. Docs/kaifa/tarstup. html) web Web管理平台 docker Docker制作脚本 docs 文档(https: //tarscloud. github. io/Tars. Docs/)
GITHUB合作 Fork -> 修改 -> pull request
The End,Thanks!
- Slides: 23