当前位置: > CentOS > CentOS教程 >

流媒体服务器负载均衡方案实现(直播流Wowza篇)

时间:2014-03-18 02:40来源:linux.it.net.cn 作者:it
直播流负载均衡的实现需要配置两个部分:一、负载均衡监听服务器;二、边缘服务器的配置。
一、负载均衡监听服务器的配置
1)首先确认已经安装好wowza服务器并从官网下载了负载均衡程序包wms-plugin-loadbalancer.jar;
2)将该程序包copy上传到服务器并拷贝到[install-dir]/lib/文件夹下;
3)拷贝conf文件夹下的crossdomain.xml文件到[install-dir]/conf目录下;
4)编辑[install-dir]/conf目录下Server.xml文件,修改内容如下所示:
A)在ServerListeners添加如下内容
              <ServerListeners>
                     <ServerListener>     <BaseClass>com.wowza.wms.plugin.loadbalancer.ServerListenerLoadBalancerListener</BaseClass>
             </ServerListener>
              </ServerListeners>
/*以上配置项开启侦听功能
B)在Properties添加如下内容
                   <Properties>
                        <Property>
                   <Name>loadBalancerListenerKey</Name>
                   <Value>023D4FB4IS83</Value>
         </Property>
         <Property>
                  <Name>loadBalancerListenerIpAddress</Name>
                  <Value>*</Value>
         </Property>
         <Property>
                   <Name>loadBalancerListenerPort</Name>
                   <Value>1934</Value>
                   <Type>Integer</Type>
         </Property>
         <Property>
                 <Name>loadBalancerListenerRedirectorClass</Name>
                 <Value>com.wowza.wms.plugin.loadbalancer.LoadBalancerRedirectorConcurrentConnects</Value>
         </Property>
        <Property>
                   <Name>loadBalancerListenerMessageTimeout</Name>
                   <Value>5000</Value>
                   <Type>Integer</Type>
        </Property>
                   </Properties>
5)修改[install-dir]/conf/VHost.xml文件
在HTTPProviders配置相内并在com.wowza.wms.http.HTTPServerVersion上修改添加如下内容:
<HTTPProvider>
         <BaseClass>com.wowza.wms.plugin.loadbalancer.HTTPLoadBalancerRedirector</BaseClass>
         <RequestFilters>*loadbalancer</RequestFilters>
         <AuthenticationMethod>none</AuthenticationMethod>
         <Properties>
                   <Property>
                            <Name>enableServerInfoXML</Name>
                            <Value>true</Value>
                            <Type>Boolean</Type>
                   </Property>
         </Properties>
</HTTPProvider>
负载均衡服务器到此设置完毕。
二、各边缘服务器的配置部署
1)将wms-plugin-loadbalancer.jar程序包copy上传到服务器并拷贝到[install-dir]/lib/文件夹下;
2)编辑[install-dir]/conf目录下Server.xml文件,修改内容如下所示:
A)在ServerListeners添加如下内容
              <ServerListeners>
                     <ServerListener>     <BaseClass>com.wowza.wms.plugin.loadbalancer.ServerListenerLoadBalancerListener</BaseClass>
             </ServerListener>
              </ServerListeners>
/*以上配置项开启侦听功能
B)设置边缘服务器的属性
               <Properties>
<Property>
        <Name>loadBalancerSenderTargetPath</Name>
        <Value>${com.wowza.wms.AppHome}/conf/loadbalancertargets.txt</Value>
</Property>
<Property>
        <Name>loadBalancerSenderRedirectAddress</Name>
        <Value>10.0.116.9</Value>
</Property>
<Property>
        <Name>loadBalancerSenderMonitorClass</Name>
        <Value>com.wowza.wms.plugin.loadbalancer.LoadBalancerMonitorDefault</Value>
</Property>
<Property>
        <Name>loadBalancerSenderMessageInterval</Name>
        <Value>2500</Value>
        <Type>Integer</Type>
</Property>
                </Properties>
3)创建[install-dir]/conf/loadbalancertargets.txt文件并添加如下内容
10.0.209.172,1934,023D4FB4IS83
4)测试
A)获取边缘服务器负载信息
http://[load-balancer-ip-address]:1935/loadbalancer?serverInfoXMLB)获取负载最小的服务器
http://[load-balancer-ip-address]:1935/loadbalancer
(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容