https://blog.csdn.net/vanjoge/article/details/108319078
结合 run_rtvs.sh/run_gw.sh/default_args.sh 的端口分配逻辑与您提供的 docker ps 实际映射,绘制完整架构如下。
一、快速总览(分层 ASCII 图)
┌───────────────── ① 终端与客户端 ─────────────────┐
│ 🚗JT808车机 🚨苏标终端 💻Web/APP 📹GB28181 │
└───────┬────────────┬───────────┬──────────┬─────┘
17806信令 │ 6030附件│ 17000消息│ 5060 SIP│
6010-29推流 │ │ 6002~6009拉流│ │
▼ ▼ ▼ ▼
┌─ 接入/管理层 ─────────────────────────────────────────────────────────┐
│ tstgw808-1(.249) attachment-1(.246) gbsip-1(.247) cvcluster-1(.254) │
│ 17806→9300 终端接入 6030 TCP/UDP 附件 5060 TCP/UDP 17000 WS/WSS │
│ 9080→80 HTTP API 9082→80 Web 9081→80 Web 30888→80/30443→443 │
└────────┬────────────────────────────────────────────────────────────────┘
│ ② /api/(RTVS→网关指令透传) ④ /api/GB/(网关→RTVS任务管理)
▼
┌─ 核心媒体层 ──────────────────────────────────────────────────────────┐
│ rtvsweb-publish-1(.11) ------ RTVS 核心(RTVSWeb.dll) │
│ 6001→80 Web │ 6002 RTSP │ 6006 Gov │ 6007 OCX │ 6008 WS │ 6009 FMP4 │
│ 6010-6029 设备JT1078推流(TCP/UDP) │ 14100-14200/UDP RTSP-RTP │
│ │⑪RTMP推流 │⑫WebRTC RTP │
│ ▼ ▼ │
│ nginx-rtmp-1(.12) sfu-mediasoup(.240) │
│ 6003 RTMP│6004 HLS│6005 WSS 14001-14002/TCP信令│14003-14007/UDP媒体 │
└────────┬──────────────────────────────────────────────────────────────┘
│ ⑬ MySQL / InfluxDB (⑤ 网关↔Redis)
▼
┌─ 存储层(仅容器内网 cvnetwork,未映射宿主机)────────────────────────┐
│ mysql5.7(.241:3306) tstgw_redis(.245:6379) influxdb(.242:8086) │
│ filecache 业务库 OCX_ORDERINFO 订单交换 监控统计 │
└─────────────────────────────────────────────────────────────────────┘
二、全景架构图(含全部调用关系)
#mermaid-svg-ur94sih61U9i8K7P{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-ur94sih61U9i8K7P .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-ur94sih61U9i8K7P .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-ur94sih61U9i8K7P .error-icon{fill:#552222;}#mermaid-svg-ur94sih61U9i8K7P .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-ur94sih61U9i8K7P .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-ur94sih61U9i8K7P .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-ur94sih61U9i8K7P .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-ur94sih61U9i8K7P .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-ur94sih61U9i8K7P .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-ur94sih61U9i8K7P .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-ur94sih61U9i8K7P .marker{fill:#333333;stroke:#333333;}#mermaid-svg-ur94sih61U9i8K7P .marker.cross{stroke:#333333;}#mermaid-svg-ur94sih61U9i8K7P svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-ur94sih61U9i8K7P p{margin:0;}#mermaid-svg-ur94sih61U9i8K7P .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-ur94sih61U9i8K7P .cluster-label text{fill:#333;}#mermaid-svg-ur94sih61U9i8K7P .cluster-label span{color:#333;}#mermaid-svg-ur94sih61U9i8K7P .cluster-label span p{background-color:transparent;}#mermaid-svg-ur94sih61U9i8K7P .label text,#mermaid-svg-ur94sih61U9i8K7P span{fill:#333;color:#333;}#mermaid-svg-ur94sih61U9i8K7P .node rect,#mermaid-svg-ur94sih61U9i8K7P .node circle,#mermaid-svg-ur94sih61U9i8K7P .node ellipse,#mermaid-svg-ur94sih61U9i8K7P .node polygon,#mermaid-svg-ur94sih61U9i8K7P .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-ur94sih61U9i8K7P .rough-node .label text,#mermaid-svg-ur94sih61U9i8K7P .node .label text,#mermaid-svg-ur94sih61U9i8K7P .image-shape .label,#mermaid-svg-ur94sih61U9i8K7P .icon-shape .label{text-anchor:middle;}#mermaid-svg-ur94sih61U9i8K7P .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-ur94sih61U9i8K7P .rough-node .label,#mermaid-svg-ur94sih61U9i8K7P .node .label,#mermaid-svg-ur94sih61U9i8K7P .image-shape .label,#mermaid-svg-ur94sih61U9i8K7P .icon-shape .label{text-align:center;}#mermaid-svg-ur94sih61U9i8K7P .node.clickable{cursor:pointer;}#mermaid-svg-ur94sih61U9i8K7P .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-ur94sih61U9i8K7P .arrowheadPath{fill:#333333;}#mermaid-svg-ur94sih61U9i8K7P .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-ur94sih61U9i8K7P .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-ur94sih61U9i8K7P .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ur94sih61U9i8K7P .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-ur94sih61U9i8K7P .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ur94sih61U9i8K7P .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-ur94sih61U9i8K7P .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-ur94sih61U9i8K7P .cluster text{fill:#333;}#mermaid-svg-ur94sih61U9i8K7P .cluster span{color:#333;}#mermaid-svg-ur94sih61U9i8K7P div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-ur94sih61U9i8K7P .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-ur94sih61U9i8K7P rect.text{fill:none;stroke-width:0;}#mermaid-svg-ur94sih61U9i8K7P .icon-shape,#mermaid-svg-ur94sih61U9i8K7P .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ur94sih61U9i8K7P .icon-shape p,#mermaid-svg-ur94sih61U9i8K7P .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-ur94sih61U9i8K7P .icon-shape .label rect,#mermaid-svg-ur94sih61U9i8K7P .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ur94sih61U9i8K7P .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-ur94sih61U9i8K7P .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-ur94sih61U9i8K7P :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} docker 网络 cvnetwork (172.29.108.0/24)
① 808信令 JT808/JT1078
TCP 17806
③ JT1078 RTP推流
TCP/UDP 6010-6029
② 指令透传 VideoControl/WCF0x9105
GetDeviceInfo
http://172.29.108.249/api/
④ 任务管理 CreateSendRTPTask
StartRealPlay/StartPlayback/Stop
http://172.29.108.11/api/GB/
⑤ 订单交换 OCX_ORDERINFO
⑥ WS 17000 消息 / HTTP 30888 管理
⑦ 集群API
⑧ RTMP6003 / HLS6004 / WSS6005
⑧ RTSP6002 / OCX6007 / WS6008 / FMP46009
WebRTC 信令14001-14002
媒体14003-14007/UDP
⑨ 报警附件上传 TCP/UDP 6030
⑩ SIP TCP/UDP 5060
GB信令转RTVS
http://172.29.108.11/
GB28181API
http://172.29.108.247/api/RTVS/
⑪ RTMP推流
rtmp://172.29.108.12:6003/mytv/
⑫ WebRTC RTP
rtp://172.29.108.240
⑬ MySQL 3306
⑬ InfluxDB 8086
🚗 JT808车载终端
🚨 苏标终端(主动安全)
💻 Web/APP客户端
📹 GB28181设备/上级平台
tstgw808-1 808网关
808GW.dll · 172.29.108.249
宿主: 17806→9300 终端接入
宿主: 9080→80 HTTP API
attachment-1 附件服务
172.29.108.246
宿主: 6030 TCP+UDP 附件上报
宿主: 9082→80 Web
gbsip-1 GB28181信令
172.29.108.247
宿主: 5060 TCP+UDP SIP
宿主: 9081→80 HTTP
cvcluster-1 集群管理
172.29.108.254
宿主: 17000 WS/WSS
30888→80 HTTP · 30443→443 HTTPS
rtvsweb-publish-1 RTVS核心
RTVSWeb.dll · 172.29.108.11
宿主: 6001→80 Web/API
6002 RTSP · 6006 Gov上级接入
6007 OCX · 6008 WS-FLV · 6009 FMP4
6010-6029 设备推流 TCP+UDP
14100-14200/UDP RTSP-RTP
nginx-rtmp-1 流媒体分发
172.29.108.12
6003 RTMP · 6004 HLS/统计页 · 6005 WSS
sfu-mediasoup WebRTC SFU
172.29.108.240
14001-14002/TCP 信令
14003-14007/UDP 媒体
mysql5.7
172.29.108.241:3306
filecache 业务库
tstgw_redis
172.29.108.245:6379
OCX_ORDERINFO
influxdb
172.29.108.242:8086
监控统计
三、端口明细表(依据 docker ps 实际映射)
| 容器 | 镜像 | 内网 IP | 宿主机端口 | 协议 | 用途 |
|---|---|---|---|---|---|
| rtvsweb-publish-1 | vanjoge/rtvs:1.3.12 | 172.29.108.11 | 6001→80 | TCP | RTVS Web 管理/API(FDWebPort) |
| 6002 | TCP | RTSP 服务 | |||
| 6006 | TCP | GovPort 上级平台接入 | |||
| 6007 | TCP | OCX 插件(FDTCPPort) | |||
| 6008 | TCP | WebSocket http-flv | |||
| 6009 | TCP | HTTP-FMP4 | |||
| 6010-6029 | TCP+UDP | 终端 JT1078 推流端口(20 路,BindPort/MappingPort) | |||
| 14100-14200 | UDP | RTSP 的 RTP/RTCP 端口范围 | |||
| nginx-rtmp-1 | vanjoge/nginx-rtmp:flvlive | 172.29.108.12 | 6003 | TCP | RTMP 服务 |
| 6004 | TCP | HLS / RTMP 统计页 | |||
| 6005 | TCP | WSS https-flv | |||
| tstgw808-1 | vanjoge/gw808 | 172.29.108.249 | 17806→9300 | TCP | JT808 终端接入(PortClient) |
| 9080→80 | TCP | 网关 HTTP API(RTVS 调用入口) | |||
| gbsip-1 | vanjoge/gbsip | 172.29.108.247 | 5060 | TCP+UDP | GB28181 SIP 信令 |
| 9081→80 | TCP | GBSIP Web | |||
| cvcluster-1 | vanjoge/cvcluster:1.3.12 | 172.29.108.254 | 17000 | TCP | 集群 WS/WSS 客户端消息通道 |
| 30888 →80 / 30443→443 | TCP | 集群管理 HTTP/HTTPS | |||
| attachment-1 | vanjoge/attachment:1.3.11 | 172.29.108.246 | 6030 | TCP+UDP | 主动安全附件上报接入 |
| 9082→80 | TCP | 附件服务 Web | |||
| sfu-mediasoup | vanjoge/mediasoup-demo:v3 | 172.29.108.240 | 14001-14002 | TCP | WebRTC HTTPS/WSS 信令 |
| 14003-14007 | UDP | WebRTC RTP 媒体 | |||
| mysql5.7 | mysql:5.7 | 172.29.108.241 | 3306(未映射) | TCP | RTVS 业务库(filecache) |
| tstgw_redis | redis:4.0.10-alpine | 172.29.108.245 | 6379(未映射) | TCP | 网关↔RTVS 订单信息交换 |
| influxdb | influxdb:1.7 | 172.29.108.242 | 8086(未映射) | TCP | 监控统计 |
端口推导来源:
PORT_DEV_START=6001起顺序分配 ------ 6001 Web、6002 RTSP、6003 RTMP、6004 统计页、6005 WSS、6006 Gov、6007 OCX、6008 WS、6009 FMP4、6010-6029 设备端口;与run_rtvs.sh的update_config()逻辑一致。
四、核心调用链
A. 实时视频点播(主链路)
车机 808网关 :.249 RTVS :.11 cvcluster :17000 Web客户端 车机 808网关 :.249 RTVS :.11 cvcluster :17000 Web客户端 #mermaid-svg-dXjJOcBf4W5y5BpH{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-dXjJOcBf4W5y5BpH .error-icon{fill:#552222;}#mermaid-svg-dXjJOcBf4W5y5BpH .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-dXjJOcBf4W5y5BpH .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-dXjJOcBf4W5y5BpH .marker{fill:#333333;stroke:#333333;}#mermaid-svg-dXjJOcBf4W5y5BpH .marker.cross{stroke:#333333;}#mermaid-svg-dXjJOcBf4W5y5BpH svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-dXjJOcBf4W5y5BpH p{margin:0;}#mermaid-svg-dXjJOcBf4W5y5BpH .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-dXjJOcBf4W5y5BpH text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-dXjJOcBf4W5y5BpH .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-dXjJOcBf4W5y5BpH .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-dXjJOcBf4W5y5BpH #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-dXjJOcBf4W5y5BpH .sequenceNumber{fill:white;}#mermaid-svg-dXjJOcBf4W5y5BpH #sequencenumber{fill:#333;}#mermaid-svg-dXjJOcBf4W5y5BpH #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-dXjJOcBf4W5y5BpH .messageText{fill:#333;stroke:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-dXjJOcBf4W5y5BpH .labelText,#mermaid-svg-dXjJOcBf4W5y5BpH .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .loopText,#mermaid-svg-dXjJOcBf4W5y5BpH .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-dXjJOcBf4W5y5BpH .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-dXjJOcBf4W5y5BpH .noteText,#mermaid-svg-dXjJOcBf4W5y5BpH .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-dXjJOcBf4W5y5BpH .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-dXjJOcBf4W5y5BpH .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-dXjJOcBf4W5y5BpH .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-dXjJOcBf4W5y5BpH .actorPopupMenu{position:absolute;}#mermaid-svg-dXjJOcBf4W5y5BpH .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-dXjJOcBf4W5y5BpH .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-dXjJOcBf4W5y5BpH .actor-man circle,#mermaid-svg-dXjJOcBf4W5y5BpH line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-dXjJOcBf4W5y5BpH :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} ⑥ 点播请求 (WS 17000)⑦ 集群API转发② /api/VideoControl Content=0x9101(IP=服务器IP, 端口=6010~6029分配)① TCP 17806 下发 0x9101③ JT1078 RTP推流 (TCP/UDP 6010~6029)⑪ 转RTMP→nginx(6003) / ⑫ WebRTC→sfu⑧ 拉流 RTSP6002 / WS6008 / FMP46009 / RTMP6003
B. 录像查询与回放
- RTVS → 网关
② /api/VideoControlContent=0x9201(查询录像),网关返回 orderId - 网关经 17806 下发 0x9201,车机应答 0x1205(录像列表)
- 网关将 0x1205 写入 Redis
⑤ OCX_ORDERINFO_{orderId}(TTL 300s),RTVS 读取后返回客户端 - 客户端选定时段 → 0x9205(回放)下发 → 车机按时段推流(同 A 的媒体链路);0x9202 暂停/快进等回放控制同样走 ②
C. 其他链路
- 808 基础业务:车机 TCP 长连接 17806,注册 0x0100 / 鉴权 0x0102 / 定位 0x0200 全走 ①
- 苏标附件 ⑨:报警终端 → attachment 6030,Web 管理 9082
- GB28181 ⑩:设备/上级 ↔ gbsip 5060;gbsip 将信令转 RTVS(
http://172.29.108.11/),RTVS 的 GB28181API 反向指向 gbsip(http://172.29.108.247/api/RTVS/);GB 设备 RTP 流入 14100-14200/UDP - WebRTC ⑫:客户端 14001-14002 信令 + 14003-14007 UDP 媒体,RTVS 转推
rtp://172.29.108.240
五、jhlantu-jt808 的替换位置
您映射的 17806→9300 与 jhlantu-jt808 的 tcp-port: 17806 完全一致,说明部署目标就是替换 tstgw808-1:
🚗车机 ──TCP 17806──▶ ┌─ tstgw808-1 (待替换) ─┐
RTVS ──9080/api/───▶ │ 可直接替换为 │ ◀── 与 jhlantu-jt808 端口契约一致:
│ jhlantu-jt808 容器 │ 17806(TCP+UDP) / 9080(HTTP)
└───────────────────────┘ /api/VideoControl 等接口已对齐
替换时的两个关键配置差异:
| 配置项 | 原网关 tstgw808-1 | jhlantu-jt808 |
|---|---|---|
| RTVS 地址 | http://172.29.108.11/api/GB/(容器内网 80) |
宿主机访问用 http://<宿主机IP>:6001/api/GB/;若容器加入 cvnetwork 可继续用 .11 |
| 订单交换 | Redis OCX_ORDERINFO_{orderId}(依赖 tstgw_redis) |
Caffeine 内存缓存 + /api/GetOrderInfo 轮询接口,无需 Redis |
即:停掉 tstgw808-1 与 tstgw_redis 后,直接 docker/run.sh start 启动 jhlantu-jt808(compose 已配置相同端口),RTVS 侧只需将 GatewayBaseAPI 指向新容器地址即可无缝切换。