How to run Vidispine with High Availability part 2 – HAProxy

By Patrik - September 30, 2015 (Last updated: April 4, 2017)

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

vidispine haproxy

Install HAProxy

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

sudo apt-get install haxproxy

Configure HAProxy

The HAProxy configuration file is located at:

/etc/haproxy/haproxy.cfg

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 http
        option httplog
        option forwardfor
        maxconn 2000
        timeout connect 5000ms
        timeout client 50000ms
        timeout server 50000ms

frontend http-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 httpchk GET /APInoauth/is-online
            http-check expect status 200

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

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

log 127.0.0.1 local0

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

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

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

frontend http-in
        bind *:8080
        default_backend vidispine

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 httpchk GET /APInoauth/is-online
        http-check expect status 200

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

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

Read the next part of the series here, where we you will learn how to use pgpool-II with PostgreSQL to create a high availability database for Vidispine.

Categories

TechnologyVidispine