I want to try HAproxy to forward incoming rtmp to LXD containers. Most all tutorials and examples are
for load balancing. I am not trying to do load balancing.
So say I have an Ubuntu server with HAproxy installed.
I also have a couple of containers on the same server. I want to be able to
forward the incoming rtmp to a specific container.
The incoming rtmp would come from OBS for instance using this format: rtmp://“server IP”:1935/Container1
or Container2, etc.
On the server end, HAproxy would route the incoming rtmp to Container1. This is not exactly load balancing.
You can consider each container is owned by a specific user for the purpose of live streaming.
Any recommendations how to configure HAproxy to handle this?
Thanks Arash. That fixed starting HAproxy. However I am getting an error when when I send rtmp to the server. Here is the config file:
ray@LPC-HAproxy:/etc/haproxy$ cat haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
#use_backend LPC2-backend if url_LPC2
#use_backend LPC3-backend if url_LPC3
#use_backend LPC4-backend if url_LPC4
default_backend LPC1-backend
backend LPC1-backend
server 10.28.172.115:1935 check
backend LPC2-backend
server 10.28.172.116:1935 check
Here is the haproxy restart:
Jun 24 10:41:37 LPC-HAproxy haproxy[6239]: [WARNING] 174/103720 (6239) : Exiting Master process…
Jun 24 10:41:37 LPC-HAproxy haproxy[6239]: [ALERT] 174/103720 (6239) : Current worker 6243 exited with code 143
Jun 24 10:41:37 LPC-HAproxy haproxy[6239]: [WARNING] 174/103720 (6239) : All workers exited. Exiting… (143)
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy rtmp-in started.
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy rtmp-in started.
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy LPC1-backend started.
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy LPC1-backend started.
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy LPC2-backend started.
Jun 24 10:41:38 LPC-HAproxy haproxy[6271]: Proxy LPC2-backend started.
And when I send rtmp, here is the failure:
Jun 24 10:31:31 LPC-HAproxy haproxy[6153]: 192.168.0.5:54741 [24/Jun/2018:10:31:31.844] rtmp-in rtmp-in/ -1/-1/-1/-1/0 400 188 - - PR-- 1/1/0/0/0 0/0 “”