1

I am on a low budget - so I am running just 2 identical Linodes (Ubuntu 18.x). I don't plan to use Nodebalancer, since I need only one server to be up at a time.

I have been able to successfully configure gluster and galera. Now it is time for keepalived.

This is the configuration I came up with.

  1. Could someone please validate to confirm this is correct?
  2. Is it correct to use public ip of the two Linodes under unicast_peer and unicast_server_ip?
  3. Also I am not sure what to define in virtual_ipaddress

MASTER:

! Configuration File for keepalived
global_defs {
    notification_email {
    }

    router_id LVS_DBCLUSTER
}

vrrp_script chk_nginx {
    script "pidof nginx"
    interval 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101

    track_interface {
        eth0
    }

    track_script {
        chk_nginx
    }

    authentication {
        auth_type PASS
        auth_pass example_password
    }

    unicast_src_ip  <master-server-public-ip, sharing enabled>
    unicast_peer {
    <secondary-server-public-ip>
    }

    virtual_ipaddress {
    <i am not sure what IP comes here>
    }
    notify_master "/bin/echo 'now master' > /tmp/keepalived.state"
    notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state"
    notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state"
}

SLAVE:

! Configuration File for keepalived
global_defs {
    notification_email {
    }

    router_id LVS_DBCLUSTER
}

vrrp_script chk_nginx {
    script "pidof nginx"
    interval 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101

    track_interface {
        eth0
    }

    track_script {
        chk_nginx
    }

    authentication {
        auth_type PASS
        auth_pass example_password
    }

    unicast_src_ip  <secondary-server-public-ip, sharing NOT enabled>
    unicast_peer {
    <master-server-public-ip>
    }

    virtual_ipaddress {
    <i am not sure what IP comes here>
    }
    notify_master "/bin/echo 'now master' > /tmp/keepalived.state"
    notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state"
    notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state"
}

I did a trial and error on this and finally both my servers became inaccessible among each. So I had to rebuild the servers. I would like a keepalived + linode expert to suggest.

0 Answers0