Quantcast
Channel: criten.org » Icecast
Viewing all articles
Browse latest Browse all 10

Clustering Icecast2 with fallback streams

$
0
0

I’m undergoing a project at the moment to setup servers in key geographic locations around the world to better deliver an Icecast stream when compared to the existing single server in Canada.

Icecast has the fallback feature on mounts so that if a mount is unavailable you can direct clients to a new mount provided its the same format and bitrate. So you can infinitely redirect users until a working mount is found.

The following is configs for servers in Australia, Europe & The United States taking the feed from 2 publishing servers and making The United States the default server to take the feed from the publishing servers:

Australia:

<relay>
    <server>us.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>eu.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-eu.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>publisher1.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-pub1.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>publisher2.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-pub2.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

<mount>
    <mount-name>/stream.mp3</mount-name>
    <fallback-mount>/stream-eu.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
   <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>1</public>
    <hidden>0</hidden>
</mount>
<mount>
    <mount-name>/stream-eu.mp3</mount-name>
    <fallback-mount>/stream-pub1.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-pub1.mp3</mount-name>
    <fallback-mount>/stream-pub2.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-pub2.mp3</mount-name>
    <fallback-mount>/stream.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>

Europe:

<relay>
    <server>us.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>au.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-au.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>publisher1.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-pub1.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>publisher2.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-pub2.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

<mount>
    <mount-name>/stream.mp3</mount-name>
    <fallback-mount>/stream-au.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>1</public>
    <hidden>0</hidden>
</mount>
<mount>
    <mount-name>/stream-au.mp3</mount-name>
    <fallback-mount>/stream-pub1.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-pub1.mp3</mount-name>
    <fallback-mount>/stream-pub2.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-pub2.mp3</mount-name>
    <fallback-mount>/stream.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>

The United States:

<relay>
    <server>publisher1.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream.mp3</local-mount>
    <on-demand>0</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>publisher2.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-pub2.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>eu.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-eu.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<relay>
    <server>au.icecast</server>
    <port>8080</port>
    <mount>/stream.mp3</mount>
    <local-mount>/stream-au.mp3</local-mount>
    <on-demand>1</on-demand>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

<mount>
    <mount-name>/stream.mp3</mount-name>
    <fallback-mount>/stream-pub2.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>1</public>
    <hidden>0</hidden>
</mount>
<mount>
    <mount-name>/stream-pub2.mp3</mount-name>
    <fallback-mount>/stream-eu.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-eu.mp3</mount-name>
    <fallback-mount>/stream-au.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>
<mount>
    <mount-name>/stream-au.mp3</mount-name>
    <fallback-mount>/stream.mp3</fallback-mount>
    <fallback-override>1</fallback-override>
    <fallback-when-full>0</fallback-when-full>
    <stream-name>Stream Name Goes Here</stream-name>
    <stream-description>Stream Description Goes Here</stream-description>
    <stream-url>
http://www.icecast</stream-url>
    <bitrate>128</bitrate>
    <public>0</public>
    <hidden>1</hidden>
</mount>

Next up for my project I need to setup BIND with GeoIP support so that DNS will direct you to your nearest server. I’ll blog about how I do that too.

I will also devise a system to detect outages with a particular node and take it out of DNS.


Viewing all articles
Browse latest Browse all 10

Trending Articles