Workload · Growing a radio audience

Icecast relay server: reach more listeners in more countries

To serve more listeners than one Icecast server can carry, you add an Icecast relay server: a second Icecast that copies your stream from the main one and plays it to its own share of the audience, ideally in a city closer to them. You can copy every stream at once or just one. Below you will find both setups in plain steps, the settings that quietly hold a relay back, how to keep its password private, and the radio CDN that gives you the same result without running any servers.

The short version
  1. Each relay takes one copy of each stream from your main server, however many people listen there
  2. Copy all your streams at once, or pick a single one
  3. Raise the clients and sources limits on each relay
  4. Lock down the config file: it holds passwords as plain text
  5. On Platinum, the radio CDN covers five cities for you

Is one server enough for your audience?

Usually yes, until your audience grows or spreads out. Three things decide it. Icecast has its own cap, the clients setting, which counts every connection to the server, including requests for stats or files, not only people listening. The network port has a cap too. And with one server, a fan tuning in from another continent still reaches all the way back to your one city.

Here is a rough feel for the port, using our own sums: bitrate times listeners, ignoring network overhead, so the real figure is a little higher.

Your streamPeople listeningBandwidth (our estimate)
96 kbps500about 48 Mbps
96 kbps4,000about 384 Mbps
192 kbps2,500about 480 Mbps

What a relay actually does

A relay is simply another Icecast that tunes in to your main server, the master, much like a listener's player would, and then passes the stream on to everyone connected to it. The Icecast reference calls this a pull system. Your main server sends each relay one copy of every stream it relays, so 2,000 people listening to one stream on a relay still cost the master a single copy of that stream.

You pick one of two styles. A master-server relay copies every stream that is not hidden, and checks back on a timer for new ones; both ends must run Icecast 2. A specific mountpoint relay copies only the stream (mount) you name, can give it a new name locally, and also works when the main server runs SHOUTcast or Icecast 1.x.

Copying all your streams to a relay

  1. On the main server, set a relay username and password in the authentication section with relay-user and relay-password. If you skip the username, Icecast uses relay.
  2. On the relay, add the lines below to its icecast.xml, using the main server's address, its port and that same username and password.
  3. Restart Icecast on the relay. It logs in, reads the list of streams and starts copying them under the same names.
  4. Every master-update-interval seconds (60 below) it checks for streams that have started since.
<master-server>origin.example.org</master-server>
<master-server-port>8000</master-server-port>
<master-update-interval>60</master-update-interval>
<master-username>relay</master-username>
<master-password>a-long-random-relay-secret</master-password>
<relays-on-demand>0</relays-on-demand>

relays-on-demand set to 0 keeps every stream flowing all the time. Set it to 1 and the relay only fetches a stream while somebody on that relay is listening, which Icecast's guide suggests for saving bandwidth when nobody is tuned in.

Copying just one stream, or a SHOUTcast one

If you only want your main show on the relay, or your main server is SHOUTcast, give the relay a relay block instead:

<relay>
    <server>origin.example.org</server>
    <port>8000</port>
    <mount>/</mount>
    <local-mount>/main.mp3</local-mount>
    <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
    <on-demand>1</on-demand>
</relay>

This example copies from a SHOUTcast server, which is why the mount is just /: Icecast asks for exactly that with SHOUTcast. Song titles travel inside a SHOUTcast stream, and a 1 in relay-shoutcast-metadata keeps them. local-mount is the name your listeners use on the relay; leave it out and the original name is kept. Add username and password only if the remote stream asks for them.

Settings that quietly hold a relay back

SettingWhy it matters on a relay
clientsEvery connection to the server added together, across all streams. Set it for the audience you want this relay to take.
sourcesCounts each copied stream as well as live encoders. Icecast's example config has 2, too few for a relay copying three streams.
queue-sizeHow far a slow listener may fall behind before being dropped. The reference default is 512k.
burst-sizeA head start sent to each new player, 64 KB by default. Keep it below queue-size, or connections can fail as they open.

Avoid fallback files on the main server's streams. Icecast's reference explains that fallback files are not played at real-time pace, so a relay would read one faster than real time and its listeners would eventually be thrown off. Fallback files on the relay's own streams are fine.

Keep the relay password private

The relay password is what lets a server ask yours for its full list of streams, so guard it like your source password. Icecast's reference calls the source password unencrypted, and as its example config shows, the relay and admin passwords sit in icecast.xml as readable text too.

  • Use a different long random password for relays than for your encoder and the admin pages.
  • Our advice: hand the file to root and Icecast's group with chown root:icecast icecast.xml (use whichever group your Icecast runs under), then chmod 640 icecast.xml, so nobody else can read it. Do it on the main server and on each relay.
  • Never commit the file to a public repository or paste it into a support forum.
  • Our advice: when the main server exists just to feed relays, you can firewall its port so that only three kinds of address get through: your relays, your encoder, and the places you open the admin pages from. Forget the encoder and your station goes silent.

Rather not run relays? Use the radio CDN

If you would rather spend your evenings on the show than on servers, our radio CDN gives a Platinum station the relay network ready-made. Your station still lives in one home city, Bucharest or New York, and every listener opens the same CDN link and hears you from the closest of five cities: New York, Bucharest, Amsterdam, Miami or San Francisco.

  • Listeners in Asia-Pacific play from San Francisco, Western Europe and Africa from Amsterdam, Latin America and the Caribbean from Miami, each with backup cities behind.
  • Your encoder can connect to the closest city too, at ingest.radio.primcast.com on port 14000; that server keeps no passwords and hands your login to your station's own server unchanged.
  • Song titles arrive as you send them, and each listener shows once in your stats.
  • We check each server every 10 seconds; after 2 missed checks back to back it is taken out, and within roughly ninety seconds new listeners are sent to that city's other server or the next city in line. When your home server goes down, listeners lose you everywhere: the CDN copies your station, it does not replace it.

Nothing to install: the CDN link and closest-server encoder details are already in your dashboard on Platinum, and links you shared before keep working. Platinum has room for 5,000 people listening together; for more, ask us for a quote. The radio plans page compares all three.

When your own relays still make sense

Running your own Icecast relays makes sense when you want your own settings, cities you choose, or rules for each stream that a managed plan does not offer. You then need a main server and a machine in each relay city. Our dedicated streaming servers come with an unmetered port, 500 Mbps or 1 Gbps depending on the line, and no traffic meter runs, so a busy evening never turns into a surprise on the invoice.

Still at the very start? Start an online radio station walks through encoders, licensing and your first night on air; relays can wait until you need them.

Questions people ask

Do I have to change anything on my main Icecast server?
Only the relay login. Add relay-user and relay-password to its authentication settings so a master-server relay can fetch the stream list. The main server needs no relay section, because the relay connects to it the way a listener does.
Will my listeners on a relay hear song titles?
When you copy from a SHOUTcast server, set relay-shoutcast-metadata to 1 in the relay block, because SHOUTcast carries titles inside the audio itself. Icecast's docs say this is on by default, but whether titles actually arrive is up to the remote server.
How does a relay notice a new stream on my main server?
A master-server relay checks the main server every master-update-interval seconds and starts copying any new stream that is not hidden. A specific mountpoint relay never picks up new streams by itself; you add another relay block.
Can I relay only when people are listening?
Yes. Set on-demand to 1 in a relay block, or relays-on-demand to 1 for a master-server relay. The relay then fetches the stream only while it has someone listening.
Is the radio CDN on every Primcast radio plan?
No, only on Platinum, at no extra charge on top of the plan. On Free and Premium, your listeners and encoder connect to your station's own server. Moving up to Platinum adds the CDN details to the same station.

Bring your station closer to every listener

Platinum stations play from the closest of five cities through one link, with nothing to set up.

Reach listeners worldwide

Read next