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 stream | People listening | Bandwidth (our estimate) |
|---|---|---|
| 96 kbps | 500 | about 48 Mbps |
| 96 kbps | 4,000 | about 384 Mbps |
| 192 kbps | 2,500 | about 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
- On the main server, set a relay username and password in the authentication section with
relay-userandrelay-password. If you skip the username, Icecast usesrelay. - 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.
- Restart Icecast on the relay. It logs in, reads the list of streams and starts copying them under the same names.
- Every
master-update-intervalseconds (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
| Setting | Why it matters on a relay |
|---|---|
clients | Every connection to the server added together, across all streams. Set it for the audience you want this relay to take. |
sources | Counts each copied stream as well as live encoders. Icecast's example config has 2, too few for a relay copying three streams. |
queue-size | How far a slow listener may fall behind before being dropped. The reference default is 512k. |
burst-size | A 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), thenchmod 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.comon 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-userandrelay-passwordto 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-metadatato 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-intervalseconds 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-demandto 1 in a relay block, orrelays-on-demandto 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.