JAVA音视频解决方案----Nginx tcp 负载均衡

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/cuiyaonan2000/article/details/97241852

序言

现在搭建起了srs的服务器,(linux系统为Centos7),有兴趣的可以研究LVS

A使用nginx来接收程序的推流来进行负载均衡

B使用nginx来负载均衡用户播放视频的请求

操作步骤

--with-stream就是开启网络层的接收转发.如需探讨请联系[email protected] 

[root@localhost cuiyaonan]# wget http://nginx.org/download/nginx-1.16.0.tar.gz
[root@localhost cuiyaonan]# yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel

[root@localhost cuiyaonan]# tar -zxvf nginx-1.16.0.tar.gz

[root@localhost cuiyaonan]# cd nginx-1.16.0/

[root@localhost cuiyaonan]# ./configure --with-stream --with-stream_ssl_module --with-http_stub_status_module

[root@localhost cuiyaonan]# make

[root@localhost cuiyaonan]# make install

配置文件内容

关于负载均衡的策略请自行百度.跟http负载均衡是一样的

#cuiyaonan add
stream {
    upstream rtmp {
        server 192.168.2.63:1935; # 这里配置成要访问的地址
    }
    server {
        listen 8989;  # 需要监听的端口
        proxy_timeout 20s;
        proxy_pass rtmp;
    }
}

猜你喜欢

转载自blog.csdn.net/cuiyaonan2000/article/details/97241852