Day 45: I managed to keep it alived!!!

In one of the previous articles, I had tried to make my keepalived work on my load balancer and terribly failed at it. Once I implemented HAProxy successfully, I realized what the mistake was.

In my previous few configurations, my HAProxy was not working properly and thus not receiving any packets. Since my keepalived was dependent on my HAProxy, that too failed to run successfully.

These are the below steps to be followed to implement keepalived successfully:
> sudo apt-get install keepalived
> sudo gedit /etc/keepalived/keepalived.conf

Then type the below configuration settings in the open file:

(In the master load balancer):

global_defs
{
    # Keepalived process identifier
    lvs_id haproxy_DH
}

# Script used to check if HAProxy is running
vrrp_script check_haproxy
{
    script "killall -0 haproxy"
    interval 2
    weight 2
}

# Virtual interface
# The priority specifies the order in which the assigned interface to take over in a failover

vrrp_instance VI_01
{
    state MASTER
    interface enp2s0
    virtual_router_id 51
    priority 101
    # The virtual ip address shared between the two loadbalancers
    virtual_ipaddress
    {
        10.0.0.5/24 brd 10.0.0.255 dev enp2s0
    }
    track_script
    {
        check_haproxy
    }
}

vrrp_instance VI_02
{
    state MASTER
    interface enx00e04c360013
    virtual_router_id 50
    priority 101
    # The virtual ip address shared between the two loadbalancers
    virtual_ipaddress
    {
        20.0.0.5/24 brd 20.0.0.255 dev enx00e04c360013
    }
}


(In the slave load balancer):

global_defs
{
    # Keepalived process identifier
    lvs_id haproxy_DH_passive
}

# Script used to check if HAProxy is running
vrrp_script check_haproxy
{
    script "killall -0 haproxy"
    interval 2
    weight 2
}

# Virtual interface
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_01
{
    state SLAVE
    interface enp2s0
    virtual_router_id 51
    priority 100
    # The virtual ip address shared between the two loadbalancers
    virtual_ipaddress
    {
        10.0.0.5/24 brd 10.0.0.255 dev enp2s0
    }
    track_script
    {
        check_haproxy
    }
}

vrrp_instance VI_02
{
    state SLAVE
    interface enx00e04c360009
    virtual_router_id 50
    priority 100
    # The virtual ip address shared between the two loadbalancers
    virtual_ipaddress
    {
        20.0.0.5/24 brd 20.0.0.255 dev enx00e04c360009
    }
}


Close the files and execute the below command:
> sudo service keepalived start

This should do it. You can find these above codes on my GitHub page as well.

In one of my previous posts, I also elaborate on how to keep the number of connections limited between the zodiac fx switch and the controller. We had looked at few statistics to decide a maximum safe number of connections and implemented the same on HAProxy. Turn out, my statistics was wrong. I had also considered the packets generated through controller - controller communication. Thus, I recorded data again, as shown by the below graph:



We shall do further analysis and decide on the threshold during this week.

Refer to previous and next posts here.

Author: Shravanya
Co-author: Swati

Comments

Popular posts from this blog

Day 12: Master Slave SDN Controller Architecture

Day 50: Tcpreplay and tcpliveplay approach

Day 10: Mininet Simulation of a basic distributed SDN controller architeture