Skip to main content

Keepalived

image.png

Keepalived es un software que brinda alta disponibilidad asignando a dos o más nodos una IP virtual (VIP) y monitoreando esos nodos, y conmutando por error cuando uno falla.

Enlaces

https://www.keepalived.org/

https://www.server-world.info/en/note?os=Ubuntu_22.04&p=keepalived&f=1

Instalar 

En todos los nodos

sudo apt -y install keepalived

Configuración

El fichero de configuración está en "/etc/keepalived/keepalived.conf". Modifícalo en cada nodo

Nodo Master

global_defs {
    # set hostname
    router_id node01
}

vrrp_instance VRRP1 {
    # on primary node, specify [MASTER]
    # on backup node, specify [BACKUP]
    # if specified [BACKUP] + [nopreempt] on all nodes, automatic failback is disabled
    state MASTER
    # if you like disable automatic failback, set this value with [BACKUP]
    # nopreempt
    # network interface that virtual IP address is assigned
    interface enp1s0
    # set unique ID on each VRRP interface
    # on the a VRRP interface, set the same ID on all nodes
    virtual_router_id 101
    # set priority : [Master] > [BACKUP]
    priority 200
    # VRRP advertisement interval (sec)
    advert_int 1
    # virtual IP address
    virtual_ipaddress {
        10.0.0.30/24
    }
}

Nodo Backup

global_defs {
    router_id node02
}

vrrp_instance VRRP1 {
    state BACKUP
    # nopreempt
    interface enp1s0
    virtual_router_id 101
    priority 100
    advert_int 1
    virtual_ipaddress {
        10.0.0.30/24
    }
}