序言
现在搭建起了srs的服务器,(linux系统为Centos7),有兴趣的可以研究LVS
A使用nginx来接收程序的推流来进行负载均衡
B使用nginx来负载均衡用户播放视频的请求
操作步骤--with-stream就是开启网络层的接收转发.如需探讨请联系cuiyaonan2000@163.com
[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;
}
}