cybertec-postgresql / vip-manager

Manages a virtual IP based on state kept in etcd or Consul
BSD 2-Clause "Simplified" License
207 stars 41 forks source link

vip-manager still bind VIP after ifdown the network interface #260

Closed XiuhuaRuan closed 1 month ago

XiuhuaRuan commented 1 month ago

I set up a patroni cluster and use vip-manager to bind VIP to the leader node. 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:85:3a:ab brd ff:ff:ff:ff:ff:ff inet 192.168.31.181/24 brd 192.168.31.255 scope global enp0s3 valid_lft forever preferred_lft forever inet 192.168.31.184/24 scope global secondary enp0s3 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe85:3aab/64 scope link valid_lft forever preferred_lft forever

But when I ifdown the network interface on the leader node, vip-manager still bound VIP to this interface. 2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 08:00:27:85:3a:ab brd ff:ff:ff:ff:ff:ff inet 192.168.31.184/24 scope global enp0s3 valid_lft forever preferred_lft forever

During the network interface down, vip-mananger keeps showing below log but actually this node was not leader any more.
Sep 27 17:47:32 sophia-pghost1 vip-manager: 2024/09/27 17:47:32 IP address 192.168.31.184/24 state is true, desired true Sep 27 17:47:42 sophia-pghost1 vip-manager: 2024/09/27 17:47:42 IP address 192.168.31.184/24 state is true, desired true Sep 27 17:47:52 sophia-pghost1 vip-manager: 2024/09/27 17:47:52 IP address 192.168.31.184/24 state is true, desired true

In my opinion, when the network interface down, vip-manager should not bind VIP to this interface any more. Please help take a check. Thanks.

pashagolub commented 1 month ago

Hello.

Yes, that is the design. We do not change anything if network is down. If network is down there are probably more serious problems with cluster than VIP.

Duplicate of #205

XiuhuaRuan commented 1 month ago

We encountered an issue on some machines that after vip-manager bound VIP to the ifdown interface, the interface will be brought up automatically and won't bind the physical IP back to this interface any more. That caused such machines never rejoined to the original cluster untill manually stopped vip-manager. So can we make an improvement to check the network interface status and physical IP before binding VIP? If the network interface is down or physical IP is absent, vip-manager will not bind VIP to this interface. That would cause no harm, but avoid some potential issues.