大网数据广告活动
服务器运维问答

Nginx-rtmp-module How edge nodes pull streams from multi Master nodes

· 52CE 我爱测

I have one master ingest server and multiple edge nodes that each pull from the ingest server. But now i have 10000 cameras push streams to master ingest server , i m afraid it can't handle it. So i plan to add more master ingest…

问题原文

原帖链接 · user3500294 · CC BY-SA 3.0

I have one master ingest server and multiple edge nodes that each pull from the ingest server. But now i have 10000 cameras push streams to master ingest server , i m afraid it can't handle it. So i plan to add more master ingest server ( with LoadBalancer LVS to handle which master ingest server those cameras will push stream to). But with more than one master ingest server how edge nodes pull all those stream . I also test pull option in edge node like this

application live {
   notify_method get;
   idle_streams off;
   pull rtmp://master_server_1/live live=1;
   pull rtmp://master_server_2/live live=1;
}

But it only pull stream from master_server_1. Any advice ? Thanks

Btw, I think i dont need more master server , just upgrade bandwidth . Is it right ? Thanks

已采纳解答

原帖链接 · Misha Nasledov · CC BY-SA 3.0

You can have a DNS record resolve to multiple origin servers -- not only could you use this for simple DNS round-robin load balancing, but this would be the way you'd have nginx-rtmp pull from multiple origins.

After a certain point, it makes sense to have more than one ingest server. Other practical considerations aside, it gives you more reliability. With just one server, you have a single point of failure.

Source: https://groups.google.com/forum/#!topic/nginx-rtmp/B2QqkwXxASk

NOTE #1: NGINX caches DNS resolutions until it is restarted. If you expect IPs to change (I'm using an AWS ELB, so they change a lot), you'll either need to mess with the DNS resolver in NGINX or use the exec_pull directive in combination with ffmpeg instead.

NOTE #2: All the nodes being pulled from must have the same streams. It has no way of knowing whether a certain stream exists on the origin or not. It will use the first available (connection wise) origin.

If you want to have origins with separate sets of streams (makes sense for scaling), you will have to manage that on your end. I've solved this using a consistent hashing algorithm to map streams to different video clusters, spreading the load around. e.g.: Streams published to origin "1" can only be played on edges pulling from origin "1". The implementation of such a system ought to be in your application layer.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。