How to redirect a client to the server with required content¶
Flussonic Media Server can connect to another Flussonic Media Server (peer), take list of running and available ondemand streams and route clients to proper peers using cluster peering mechanism.
Configuration¶
Creating a peer¶
To add Flussonic Media Server peer, go to Cluster > Settings. Enter a cluster key and a new peer hostname, then click Save.
You need to set same cluster_key
on all cluster hosts.
Note
When you add a peer via Flussonic UI, you cannot specify port in the New peer hostname field. You can specify a port later, in the API URL field in the settings of the created peer. See Peer settings.
You can also add Flussonic Media Server peer via the configuration file:
cluster_key abcd;
peer streamer:8081;
You can set multiple peers as well:
cluster_key abcd;
peer peer1.example.com;
peer peer2.example.com;
peer peer3.example.com;
All peers can have different streams, Flussonic Media Server will route clients to proper peers.
Peers statistics¶
You can view the statistics of the streams captured by peers in the cluster on the Cluster > Overview tab.
For each peer, you can see:
- CPU usage
- Memory usage
- Number of connected clients
- Number of captured streams
- Output bitrate
- Network interface load in percent
- Uptime
Peer settings¶
To view and edit settings of an individual peer, go to Cluster > Settings > click the "edit" icon next to a peer.
The page displaying the peer settings will open.
Here you can edit the following peer properties:
- API URL – the internal address for communication in a local network (it can contain port number).
- Public payload URL – the public address that is exposed to clients.
- Private payload URL – the internal address for communication in a local network (by default, it is equal to API URL).
- Fetch timeout – how often the peer will try to get the data from the remote server via internal API (in milliseconds).
- Stale timeout – the time (in milliseconds) after which deleted streams on this server are considered to be inactive and cannot be used in
cluster_ingest
. - Channel limit – maximal number of streams.
- CPU limit in percents
- Cluster key – the key for authorization for inter-Flussonic connections. All cluster peers should have the same cluster key.
Private and public addresses of peers¶
When the peer Flussonic servers are in the local network and in the settings you use the private addresses (hostnames) that are necessary for the communication of peers within the local network, these internal addresses can appear on the clients that playback a stream.
You can expose only the public addresses of peers, at the same time allowing them to use private addresses when communicating within a cluster. To do so, specify the public address in the Public payload URL field on the Settings tab (see Peer settings).
Alternatively, you can add the public
option in the settings of each peer in the configuration file:
cluster_key abcd;
peer streamer:8081 {
public streamer.public;
}
When redirecting to streamer1.example.com
, Flussonic will use the protocol, HTTP or HTTPS, that was configured for this peer.
Redirection¶
Flussonic Media Server will redirect clients to peers when you ask for a stream.
It is a very important difference between peer and source, because source is designed for moving data via a dedicated channel from origin to edge.
Peering is designed for situations when client can take video stream from any server in a group, so servers (peers) in a group talk to each other and tell what streams do they have.
When client connects via HLS, HTTP MPEG-TS, RTSP, RTMP or opens embed.html
to any of servers in a group,it may redirect to another server where this stream is really located.