Ubuntu 24.04
Sponsored Link

Keepalived : समूह वीआरआरपी उदाहरण2024/07/23

 

एकाधिक VRRP उदाहरणों को समूहित करने के लिए, समूह में किसी इंटरफ़ेस पर समस्या होने पर उन्हें सिंक में फेलओवर करना संभव है।

यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।

                              VIP:10.0.0.30
+----------------------+            |            +----------------------+
|  [node01.srv.world]  |10.0.0.51   |   10.0.0.52|  [node02.srv.world]  |
|     Keepalived#1     +------------+------------+     Keepalived#2     |
|                      |192.168.0.51|192.168.0.52|                      |
+----------------------+            |            +----------------------+
                              VIP:192.168.0.30

[1] प्राथमिक नोड पर Keepalived कॉन्फ़िगर करें।
root@node01:~#
vi /etc/keepalived/keepalived.conf
global_defs {
    router_id node01
}

# समूह सेटिंग
vrrp_sync_group VG1 {
    group {
        INTERNAL
        EXTERNAL
    }
}

# VRRP इंस्टेंस सेटिंग
vrrp_instance INTERNAL {
    state MASTER
    interface enp1s0
    virtual_router_id 101
    priority 200
    advert_int 1
    virtual_ipaddress {
        10.0.0.30/24
    }
}

# VRRP इंस्टेंस सेटिंग
vrrp_instance EXTERNAL {
    state MASTER
    interface enp9s0
    virtual_router_id 201
    priority 200
    advert_int 1
    virtual_ipaddress {
        192.168.0.30/24
    }
}

root@node01:~#
systemctl restart keepalived
[2] बैकअप नोड पर Keepalived कॉन्फ़िगर करें।
root@node02:~#
vi /etc/keepalived/keepalived.conf
global_defs {
    router_id node02
}

# समूह सेटिंग
vrrp_sync_group VG1 {
    group {
        INTERNAL
        EXTERNAL
    }
}

# VRRP इंस्टेंस सेटिंग
vrrp_instance INTERNAL {
    state BACKUP
    interface enp1s0
    virtual_router_id 101
    priority 100
    advert_int 1
    virtual_ipaddress {
        10.0.0.30/24
    }
}

# VRRP इंस्टेंस सेटिंग
vrrp_instance EXTERNAL {
    state BACKUP
    interface enp9s0
    virtual_router_id 201
    priority 100
    advert_int 1
    virtual_ipaddress {
        192.168.0.30/24
    }
}

root@node02:~#
systemctl restart keepalived
[3] ठीक है। फ़ेलओवर सत्यापित करें।
root@node01:~#
ip address show enp1s0; ip address show enp9s0

2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:5b:6d:b6 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet 10.0.0.30/24 scope global secondary enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe5b:6db6/64 scope link
       valid_lft forever preferred_lft forever
3: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:16:f9:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.51/24 brd 192.168.0.255 scope global enp9s0
       valid_lft forever preferred_lft forever
    inet 192.168.0.30/24 scope global secondary enp9s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe16:f935/64 scope link
       valid_lft forever preferred_lft forever

root@node01:~#
ip link set down enp1s0
root@node01:~#
ip address show enp1s0; ip address show enp9s0

2: enp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 52:54:00:5b:6d:b6 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
3: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:16:f9:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.51/24 brd 192.168.0.255 scope global enp9s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe16:f935/64 scope link
       valid_lft forever preferred_lft forever
मिलान सामग्री