In the second part of the High Availability series we take a look on how you can use HAProxy together with Vidispine, and make sure your digital media assets always are available.

In the second part of the High Availability series we take a look on how you can use HAProxy together with Vidispine to get better availability. In Part #1 we showed a simple way to cluster Vidispine. In Part #3 we will add pgpool-II for a high availability database, and in the final Part #4 we show how you can work with SolrCloud.

Install HAProxy

This guide assumes that you are running Ubuntu. Start by installing HAProxy:

sudo apt-get install haxproxy
CODE

CONFIGURE HAPROXY

The HAProxy configuration file is located at:

/etc/haproxy/haproxy.cfg
CODE

Below is a basic configuration that you could use. For more info about HAProxy configuration, please refer to the HAProxy Configuration Manual.

global
        log 127.0.0.1 local0
        maxconn 4096
        daemon
defaults
        log global
        mode https
        option httpslog
        option forwardfor
        maxconn 2000
        timeout connect 5000ms
        timeout client 50000ms
        timeout server 50000ms

frontend https-in
        bind *:8080
        default_backend vidispine

backend vidispine
        server server1 10.185.20.1:8080 maxconn 32 check inter 5s rise 5 fall 5
        server server2 10.185.20.2:8080 maxconn 32 check inter 5s rise 5 fall 5

        option httpschk GET /APInoauth/is-online
            https-check expect status 200

        stats enable
        stats uri /stats
        stats auth  admin:admin
        stats admin if TRUE
CODE

HAProxy uses syslog for logging. So besides this line in haproxy.cfg:

log 127.0.0.1 local0
CODE

one more line is needed in your syslog configuration file ( /etc/rsyslog.conf under Ubuntu):

local0.*; /var/log/haproxy/haproxy.log
CODE

In this config, HAProxy will accept all connections made to port 8080 , and forward them to a backend group called vidispine .

frontend https-in
        bind *:8080
        default_backend vidispine
CODE

The backend group is configured to forward requests to the two Vidispine instances.

backend vidispine
        server server1 10.185.20.1:8080 maxconn 32 check inter 5s rise 5 fall 5
        server server2 10.185.20.2:8080 maxconn 32 check inter 5s rise 5 fall 5

        option httpschk GET /APInoauth/is-online
        https-check expect status 200
CODE

HAProxy will check the server health by making GET requests to /APInoauth/is-online on each server, and expect the return code to be 200 . The health check interval is 5 seconds ( check inter 5s ). A server is considered as online after 5 consecutive successful health checks ( rise 5 ), and offline after 5 consecutive unsuccessful health checks( fall 5 ).

HAProxy also provides a statistics page for monitoring the status of backend servers, which is enabled by:

stats enable
stats uri /stats
stats auth  admin:admin
stats admin if TRUE
CODE

stats uri defines the virtual URL to access the statistics page. So in this case, it would be https://localhost:8080/stats on the HAProxy server.

Read the next part of the series here: