2

Is it possible to configure keepalived in such a way?

In normal state VIP_1 assigned to SERVER_1 and VIP_2 assigned to SERVER_2

On server failure all VIP's going to working server, and after failed server becomes live we don't migrate his VIP back to him, we need to do it manual due to some content-replication reasons.

configuration at the moment:

#SERVER_1        
vrrp_sync_group VG1 {
        group {
          content
        }
    }


    vrrp_instance content {
        state BACKUP  
        interface eth1
        virtual_router_id 1  
        priority 100
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1212 
        }
        virtual_ipaddress {
            192.168.100.111/24
        }
    }

    # SERVER_2

    vrrp_sync_group VG1 {
        group {
          content
        }
    }

    vrrp_instance content {
        state BACKUP  
        interface eth1
        virtual_router_id 1  
        priority 100
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1212  
        }
        virtual_ipaddress {
            192.168.100.111/24     }
    }
slm
  • 7,615
  • 16
  • 56
  • 76
Denis
  • 23
  • 2
  • 5

1 Answers1

1

On host 1:

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    dont_track_primary
    virtual_router_id 1
    priority 150
    advert_int 5
    mcast_src_ip 172.16.40.1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
    10.0.0.1/24 dev eth0
    }
}

vrrp_instance VI_2 {
    state BACKUP
    interface eth0
    dont_track_primary
    virtual_router_id 5
    priority 100
    advert_int 5
    mcast_src_ip 172.16.40.1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.2/24 dev eth0
    }
}

On host 2:

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    dont_track_primary
    virtual_router_id 1
    priority 100
    advert_int 5
    mcast_src_ip 172.16.40.2
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.1/24 dev eth0
    }
}

vrpp_instance VI_2 {
    state MASTER
    interface eth0
    dont_track_primary
    virtual_router_id 5
    priority 150
    advert_int 5
    mcast_src_ip 172.16.40.2
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.2/24 dev eth0
    }
}

For the no-auto-failback, look at nopreempt in the keepalived.conf man page but also see: http://article.gmane.org/gmane.linux.keepalived.devel/1537%22

dmourati
  • 25,540
  • 2
  • 42
  • 72
  • errm, can't correct IPs instead of `blah blah blah` sections in your answer, always get 2 IPs on same server. can you make more detailed configuration? – Denis Feb 28 '13 at 12:30
  • Updated with sample RFC 1918 addresses on dev eth0 10.0.0.1 is primary on VIP on host1, 10.0.0.2 is for host2. Failover is bidirectional. See note about about nopreempt but use BACKUP for initial states for all VIPs. – dmourati Feb 28 '13 at 17:43