Setting up load balanced streaming on Wowza 2.2.3

From Guild TV
Jump to: navigation, search

This guide will give you a brief tutorial on setting up Wowza 2.2.3 with load balancing.

How Wowza’s load balancing works

The idea behind Wowza’s implementation of load balancing is to have one or more load balancers which dictate which server is used to provide the stream to a user, based on how many people are connected to each server. The load is balanced by streaming to new clients from servers with lower connection counts.

Installing Wowza

Simple Ubuntu Setup

Configuring for Ubuntu 12.04 server is simple, due to a short setup script. Simply run:

bash <(wget -O -)

The installer should run itself, with a prompt at the start for the loadbalancer secret.

The server should launch itself, but it can also be started with:

 sudo service WowzaMediaServer start

Wowza will now run at startup with the server.


Provision one ‘listener’ server (the load balancer) and n ‘edge’ servers (actual stream hosts) - both preferably as Amazon EC2 instances running Amazon Linux AMI (or any Red Hat derivative).

Other distros are also usable, with slight modification to the instructions.

Setting up the executable

Copy the wowza.rpm.bin package to each of the servers (either download from the live broadcast repository at or SFTP). Run:

chmod +x wowza.rpm.bin

on each server to make the binary executable. Make sure you are running as root by this point. Run:


to run the executable. This will start the install to /usr/local/WowzaMediaServer. Run:


to enter the licence key. The Wowza instance will then start; it can be terminated by pressing Ctrl-C.

DNS updates

Make sure all DNS CNAME or other entries are updated to be in line with the server IP addresses before continuing.

The Wowza install directory will hereby be referred to as /~wowza/.

Setting up the load balancer

Config changes

Browse to the local directory files/listener. Copy all of the files and folders as-is into the /~wowza/ directory on the load balancing server, overwriting as necessary. This sets up all the configuration for the load balancer.

If you wish to change the authentication token used between the load balancer and all edge servers, open the file /~wowza/conf/Server.xml and find the line:


Edit the <Value> line beneath to a new 12-character string. Make sure each edge server has their key updated as described below.

Starting the server

To start the server, run:


Setting up an edge server

Repeat these instructions for each edge server you have provisioned.

Copy configuration files

Browse to the local directory files/edge. Copy all of the files and folders as-is into the /~wowza/ directory, overwriting as necessary. This sets up a majority of the configuration for the server.

Config changes

Open the file /~wowza/conf/Server.xml. Navigate to the <Properties> section and find the line:


Edit the <Value> line beneath from [redirect-address] to the address/ hostname of the edge server (e.g.

Open the file /~wowza/conf/loadbalancertargets.txt and edit the second line from [load-balancer-ip-address] to the address/hostname of the load balancer.

If the authentication token used between the load balancer and edge servers has been changed from its default, change the third value on the line from 28EAF137113C to that of the new token.

Start the server

To start the server, run:


Viewing load balancing statistics

When the load balancer is running, it displays a page in XML format which provides data about currently connected users and other such information, which is available at:


where [load-balancer] is the address/hostname of the load balancing server.

Streaming to an edge server

The edge servers are set up by default with an ‘application’ called live. Streaming to the servers using a program such as Wirecast would be configured as below (assuming an edge server at the address is running):


The stream name can be anything, though should be kept relevant to the event. The stream needs to only be pushed to the load balancer (with application name liveorigin) as it should be configured to distribute it to all the edge servers.

Viewing the stream

The stream (managed by the load balancer) can be accessed through a Flash player (JW Player) which supports Wowza’s load balanced streaming setup. Example JavaScript for displaying a load balanced stream using JW Player are shown below:

var flashvars = { 
      streamer:'rtmp://', autostart: true
swfobject.embedSWF('player.swf', 'video', '1000', '564', '9.0.115', 'false', flashvars, 
   { allowfullscreen:'true', allowscriptaccess:'always' },
   { id:'jwplayer', name:'jwplayer', style:'opacity:1'}

In this instance, the stream name is test-stream, and the load balancer is located at The ‘application’ used by Wowza on the load balancer is called redirect, and this returns an address/hostname of one of the edge servers reporting in to the load balancer back to the player. The player then connects directly to the edge server specified by the load balancer.

Wowza Plugins

A couple of simple wowza plugins have been written for guildtv. They are available on GitHub. Guides on their use can be found there too.


Live repeater setup guide