3 Star 6 Fork 4

winlinvip / srs.wiki

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
v3_EN_SampleOriginCluster.md 4.42 KB
一键复制 编辑 原始数据 按行查看 历史
winlinvip 提交于 2022-01-06 11:57 . Update

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

1
https://gitee.com/winlinvip/srs-wiki.git
git@gitee.com:winlinvip/srs-wiki.git
winlinvip
srs-wiki
srs.wiki
master

搜索帮助