It is possible to configure multiple instances of Storm Streaming Server into a group (cluster). The main advantage of this approach is load balancing and redundancy capabilities. Servers can be configured in a hierarchical structure with one or more origin servers (this is where content is published) and multiple edge servers, or in a flat arrangement, where each server works as a gateway.
In this approach, all incoming streams will be put on origin servers, while edge servers will copy the signal and redistribute it among viewers. In the preferences.xml file we must first configure its role.
For origin the configuration will look as follow:
<Cluster>
<role>Origin</role>
<allowedIPs>192.168.0.3, 192.168.0.4</allowedIPs>
<password>mypassword</password>
</Cluster>
Parameter | Description |
---|---|
role | It can be either "origin" or "edge." In this example, we’re only presenting the origin configuration |
allowedIPs | List of IPs separated by a comma (space is optional). Only servers from these IPs will be allowed to connect. If the list is empty, you can still join servers using the password parameter. Both the allowedIPs and the password fields can be used together or separately, but at least one must be present for a cluster to work |
password | Password for the cluster. If the field is empty, the password won’t be checked, but the system will rely on the allowedIPs list. Both the allowedIPs and the password fields can be used together or alone, but at least one must be present |
Now we need to configure Edge server
<Cluster>
<role>Edge</role>
<password>mypassword</password>
<originIPs>192.168.0.1, 192.168.0.2</originIPs>
</Cluster>
Parameter | Description |
---|---|
role | As mentioned above in this case, it must be set to "Edge" |
allowedIPs | If a password is not required by the Origin server this field can be omitted |
originIPs | List of origin servers to which this edge server must connect to. IPs must be separated by a comma (space is optional) |
We’ll also have to setup the gateway:
<Gateway enabled="true" loadbalancing="true" checkInterval="3" />
Parameter | Description |
---|---|
enabled | Not all edge servers must have a gateway enabled. Other gateways will decide on them regarding their load if necessary |
loadbalancing | If this option is set to true a gateway will redirect the viewer to the least utilized server. Otherwise, stream data will be provided from a given server |
checkInterval | Since all servers ask and hold information regarding each other’s loads, these are being checked and reported in intervals. For most cases, we advise keeping this value around 3 (seconds) |