Stream Relaying

Configure load balancing and geographic distribution

Overview

Relaying enables one Mcaster1DNAS server to mirror streams from another server, distributing listeners across multiple physical machines. This is essential for large-scale broadcasts requiring geographic distribution or load balancing. The master server provides the original content while slave servers relay it to their own listeners.

Types of Relays

Mcaster1DNAS v2.5.1-rc1 supports two relay types:

1. Master-Slave Relay

Requires both master and slave to be Mcaster1DNAS servers. The slave automatically mirrors ALL mountpoints from the master and periodically checks for new mountpoints to relay. This provides complete automatic replication.

2. Single-Broadcast Relay

Relays a specific single mountpoint from any compatible server (Shoutcast, Icecast 1.x, or Mcaster1DNAS). This provides fine-grained control over which streams to relay.

Master-Slave Relay Configuration (YAML)

Configure the slave server to automatically mirror all mountpoints from a master server. This configuration goes in the slave server's YAML file.

# Slave Server Configuration (mcaster1.yaml)
relay:
  master:
    server: 192.168.1.11
    port: 8001
    username: relay
    password: hackme
    update_interval: 120  # Check for new mounts every 120 seconds
    redirect: true        # Enable listener redirection from master

Configuration Parameters

Note: The master server does not need to be configured for relaying. It remains unaware that slaves are pulling its streams. All mountpoint names on the slave will match the master.

Listener Redirection

Enable load distribution by allowing the master to redirect new listeners to slave servers using HTTP 302 responses.

Master Server Configuration:

# Master Server (mcaster1.yaml)
relay:
  max_redirect_slaves: 5  # Allow up to 5 slaves for redirection

Slave Server Configuration:

# Slave Server (mcaster1.yaml)
relay:
  master:
    server: 192.168.1.11
    port: 8001
    username: relay
    password: hackme
    redirect: true  # Register for redirection

Single-Broadcast Relay Configuration (YAML)

Relay specific mountpoints with full control over configuration. This works with any Icecast-compatible server including Shoutcast.

# Slave Server Configuration (mcaster1.yaml)
relay:
  relays:
    - server: 192.168.1.11
      port: 8001
      mount: /example.ogg
      local_mount: /different.ogg  # Optional: rename on slave
      username: relay
      password: hackme

    - server: shoutcast.example.com
      port: 8000
      mount: /                     # Shoutcast always uses /
      local_mount: /shoutcast.mp3
      relay_shoutcast_metadata: true  # Include embedded metadata

Single-Relay Parameters

Shoutcast Relaying: When relaying from Shoutcast servers, always use mount: / and set relay_shoutcast_metadata: true to preserve song information embedded in the stream.

Use Cases and Architecture

Geographic Distribution

Deploy slaves in different geographic regions to reduce latency for listeners worldwide.

# Master in USA, Slaves in EU and Asia
Master (USA): stream.example.com
Slave (EU):   eu.stream.example.com
Slave (Asia): asia.stream.example.com

Load Balancing

Distribute thousands of listeners across multiple servers to prevent overload.

# DNS round-robin or load balancer
stream1.example.com → Slave 1 (relay from master)
stream2.example.com → Slave 2 (relay from master)
stream3.example.com → Slave 3 (relay from master)

Failover and Redundancy

Configure multiple slaves so that if one fails, others continue serving listeners.

Monitoring Relay Performance

Mcaster1DNAS v2.5.1-rc1 provides enhanced relay statistics:

http://slaveserver:8000/admin/stats.xml

Security Considerations

Next Steps: Learn about Configuration Options or explore YP Directory Setup.