6

Steps

  1. Start both master and slave
  2. Keep pinging virtual ip (i.e 192.168.10.100)
  3. Shutdown master
  4. Slave enters MASTER state
  5. Restart master
  6. Slave enters BACKUP state and Master enters MASTER state

Ping doesn't work after step 6. No server gets the virtual ip. (I checked with ip addr show eth1)

Master can get back the virtual ip until I restart the keepalived service.

How to make the master getting virtual ip without restart the service?

Keepalived configuration:

host1 (master)

vrrp_instance VI_1 {
    state MASTER
    interface eth1
    virtual_router_id 51
    priority 101
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secret
    }
    virtual_ipaddress {
        192.168.10.100
    }
}

host2 (slave)

vrrp_instance VI_1 {
    state BACKUP
    interface eth1
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secret
    }
    virtual_ipaddress {
        192.168.10.100
    }
}
Franz Wong
  • 161
  • 1
  • 2

2 Answers2

0

Only thing that jumps out different between your config and ones I'm using are that I have

virtual_ipaddress { <ip> dev <devname> }

That may not strictly be necessary, but that's the only difference I can see vs. a known working setup.

Nathan Neulinger
  • 597
  • 1
  • 5
  • 16
0

Explanations you can find here: https://github.com/acassen/keepalived/blob/317555e304372205cf634f252e72c5b6de0eb1b6/doc/man/man5/keepalived.conf.5

For electing MASTER, highest priority wins. to be MASTER, make this 50 more than on other machines.

Difference between your MASTER and BACKUP priority 101-100=1. It must be at least 50. Change your MASTER priority from 101 to 100 and BACKUP priority from 100 to 50.

  • Your answer looks to be a good quality one, **but** it is not enough. Please try to formulate in round sentences, it should be understable easily (also for people with very different native language or with little knowledge on the topic). – peterh Aug 02 '17 at 00:15