Skip to content

v3_EN_SampleOriginCluster

winlin edited this page Jan 6, 2022 · 18 revisions

HOME > CN > Origin Cluster

RTMP Origin Cluster

RTMP Origin Cluster is a powerful feature for huge pushing streams, we could use RTMP Origin Cluster and RTMP Edge Cluster together, to support huge pushing and pulling streams.

Suppose your server is: 192.168.1.170

Step 1: Get SRS, for more information please read here

git clone https://github.com/ossrs/srs cd srs/trunk

Or update your repository:

git pull

Step 2: Build SRS, for more information please read here

./configure && make

Step 3: Config the first origin, Origin ServerA, for more information please read here

You can use the file conf/origin.cluster.serverA.conf, or write your own:

# conf/origin.cluster.serverA.conf listen 19350; max_connections 1000; daemon off; srs_log_tank console; pid ./objs/origin.cluster.serverA.pid; http_api { enabled on; listen 9090; } vhost __defaultVhost__ { cluster { mode local; origin_cluster on; coworkers 127.0.0.1:9091; } }

Step 4: Config the second origin, Origin ServerB, for more information please read here

You can use the file conf/origin.cluster.serverB.conf, or write your own:

# conf/origin.cluster.serverB.conf listen 19351; max_connections 1000; daemon off; srs_log_tank console; pid ./objs/origin.cluster.serverB.pid; http_api { enabled on; listen 9091; } vhost __defaultVhost__ { cluster { mode local; origin_cluster on; coworkers 127.0.0.1:9090; } }

Step 5: Config edge server, which pulls streams from Origin Servers, for more information please read here

You can use the file conf/origin.cluster.edge.conf, or write your own:

# conf/origin.cluster.edge.conf listen 1935; max_connections 1000; pid objs/edge.pid; daemon off; srs_log_tank console; vhost __defaultVhost__ { cluster { mode remote; origin 127.0.0.1:19351 127.0.0.1:19350; } }

Step 6: Start SRS servers, for more information please read here

./objs/srs -c conf/origin.cluster.serverA.conf & ./objs/srs -c conf/origin.cluster.serverB.conf & ./objs/srs -c conf/origin.cluster.edge.conf &

Step 7: Push stream to any Origin Server, for more information please read here

By FFMEPG:

 for((;;)); do \ ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \ -vcodec copy -acodec copy \ -f flv -y rtmp://192.168.1.170:19350/live/livestream; \ sleep 1; \ done

Or FMLE:

FMS URL: rtmp://192.168.1.170:19350/live Stream: livestream

Step 8: Play RTMP stream from Edge server, for more information please read here

RTMP URL is: rtmp://192.168.1.170/live/livestream, you can choose VLC, or only player srs-player.

Remark: Replace the IP 192.168.1.170 to your server IP.

Winlin 2018.2

Welcome to SRS wiki!

SRS 5.0 wiki

Please select your language:

SRS 4.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 1.0 wiki

Please select your language:

Clone this wiki locally