So, I am trying to forward incoming rtmp to a HAproxy server to a container
that has the media server on the same server.

I am sending rtmp from OBS with the streaming set to  rtmp://"HAproxy server
IP":1935/LPC1

 

And here is my haproxy.cfg:

 

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=hapro
xy

        ssl-default-bind-ciphers
ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RS
A+AES:!aNULL:!MD5:!DSS

        ssl-default-bind-options no-sslv3

 

defaults

        log     global

        mode    http

        option  httplog

        option  dontlognull

        timeout connect 5000

        timeout client  50000

        timeout server  50000

        errorfile 400 /etc/haproxy/errors/400.http

        errorfile 403 /etc/haproxy/errors/403.http

        errorfile 408 /etc/haproxy/errors/408.http

        errorfile 500 /etc/haproxy/errors/500.http

        errorfile 502 /etc/haproxy/errors/502.http

        errorfile 503 /etc/haproxy/errors/503.http

        errorfile 504 /etc/haproxy/errors/504.http

 

frontend rtmp-in

        mode tcp

        bind *:1935

        acl url_LPCX path_beg -i /LPC1/

        use_backend LPC1-backend if url_LPCX

        #acl url_LPCX path_beg -i /LPC2/

        #use_backend LPC2-backend if url_LPCX

        #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

#backend LPC2-backend

#backend LPC3-backend

#backend LPC4-backend

 

And here is the log after restarting HAproxy with mode=http:

 

Jun 24 13:25:12 LPC-HAproxy haproxy[3498]: [WARNING] 174/132002 (3498) :
Exiting Master process...

Jun 24 13:25:12 LPC-HAproxy haproxy[3498]: [ALERT] 174/132002 (3498) :
Current worker 3500 exited with code 143

Jun 24 13:25:12 LPC-HAproxy haproxy[3498]: [WARNING] 174/132002 (3498) : All
workers exited. Exiting... (143)

Jun 24 13:25:13 LPC-HAproxy haproxy[3530]: Proxy rtmp-in started.

Jun 24 13:25:13 LPC-HAproxy haproxy[3530]: Proxy rtmp-in started.

Jun 24 13:25:13 LPC-HAproxy haproxy[3530]: Proxy LPC1-backend started.

Jun 24 13:25:13 LPC-HAproxy haproxy[3530]: Proxy LPC1-backend started.

 

And here is the log after restarting HAproxy with mode=tcp:

 

Jun 24 13:14:29 LPC-HAproxy haproxy[3348]: [WARNING] 174/130935 (3348) :
Exiting Master process...

Jun 24 13:14:29 LPC-HAproxy haproxy[3348]: [ALERT] 174/130935 (3348) :
Current worker 3352 exited with code 143

Jun 24 13:14:29 LPC-HAproxy haproxy[3348]: [WARNING] 174/130935 (3348) : All
workers exited. Exiting... (143)

Jun 24 13:14:29 LPC-HAproxy haproxy[3384]: [WARNING] 174/131429 (3384) :
parsing [/etc/haproxy/haproxy.cfg:26] : 'option httplog' not usable with
frontend 'rtmp-in' (needs 'mode http'). Falling back to 'option tcplog'.

Jun 24 13:14:29 LPC-HAproxy haproxy[3384]: Proxy rtmp-in started.

Jun 24 13:14:29 LPC-HAproxy haproxy[3384]: Proxy rtmp-in started.

Jun 24 13:14:29 LPC-HAproxy haproxy[3384]: Proxy LPC1-backend started.

Jun 24 13:14:29 LPC-HAproxy haproxy[3384]: Proxy LPC1-backend started.

 

And here is the error when I start the stream:

 

When mode = http:

 

Jun 24 13:20:28 LPC-HAproxy haproxy[3500]: 192.168.0.5:58373
[24/Jun/2018:13:20:28.665] rtmp-in rtmp-in/<NOSRV> -1/-1/-1/-1/0 400 188 - -
PR-- 1/1/0/0/0 0/0 "<BADREQ>"

 

When mode = tcp:

 

Jun 24 13:15:54 LPC-HAproxy haproxy[3386]: 192.168.0.5:58356
[24/Jun/2018:13:15:54.814] rtmp-in LPC1-backend/<NOSRV> -1/-1/0 188 PR
1/1/0/0/3 0/0

 

One thing that confuses me is that all of the tutorials/examples are for
doing load balancing.  In my case I only want to do forwarding

based on the incoming rtmp.  Note LPC can be LPC1-4.  And subsequently
should forwarded to container 1-4, which are named LPC1-4

in lxc.

 

Can anyone help?   


Thanks,

 

Ray

 

Reply via email to