Score:0

Keepalived how to define VIPs that persist across reboots, on both master and backup nodes?

sh flag

I'm trying to find a way to persits the keepalived virtual ips across the cluster, on master and backup nodes.

By default, keepalived only activates the virtual ip, on the node that is playing the master role. All the other nodes will have it removed.

What I want to achieve is the have this virtual ip active all the time on all the nodes (master and backup), even after the master gets restarted.

Up until now, I was able to activate the VIP on all my nodes, by running the command:

sudo ip addr add 192.168.1.100/24 dev enp0s3

But the problem with this is that: once I'm restarting the master node, the VIPs will be removed from the backup nodes.

I need something that will persist these VIPs even after the master restart. Any ideas?

Thanks

HBruijn avatar
in flag
Uhhh I don’t quite understand what you want to achieve there? Generally the whole concept of a VIP managed by a cluster manager is to have it active and assigned to only one single cluster node at a time. When that is not necessary, then that VIP doesn’t need to be managed by keepalived at all, right ? Just activate the VIP on system boot for your cluster nodes, like you would do with the other (secondary) IP-address on a host.
Yonoss avatar
sh flag
I need this "sticky" VIP in order to be able to set up a HA load balancing system. Basically right behind the VIP I am planning to set up NGINX LBs on each node. If I won't have the sticky VIPs , if NGINX LB in the master node will go down, while the Master VIP will still be running, the whole cluster will become unavailable. With sticky VIPs, the backup NGINX LBs will be able to take over, in this situation.
Yonoss avatar
sh flag
And all this because I cannot make the keepalived load balancing to work :) : https://serverfault.com/questions/1139286/keepalived-load-balancing-not-working-on-fedora-38-2-nodesvms-setup
Score:0
sh flag

The solution I've found was to define a static ip at the keepalived.conf file level, on all the nodes. Is this static ip will be different than your VIP, it will pe persisted accross nodes even after restarts, and you can call this IP to access your app:

static_ipaddress {
  192.168.1.101/24 dev ens18
}

My conf file looks like this:

static_ipaddress {
  192.168.1.101/24 dev ens18
}
vrrp_instance VI_1 {
  state MASTER
  interface ens18
  virtual_router_id 55
  priority 150
  advert_int 1
  unicast_src_ip 192.168.1.199
  unicast_peer {
    192.168.1.84
  }

  authentication {
    auth_type PASS
    auth_pass ***
  }

  virtual_ipaddress {
    192.168.1.100/24
  }
}
virtual_server 192.168.1.101 80 {
  delay_loop 6
  lb_algo rr
  lb_kind NAT
  protocol TCP

  real_server 192.168.1.199 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
  real_server 192.168.1.84 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.