SRE practices: SLOs, incidents, redundancy / Stage 7 of 8 · step 9 of 10
The site address does not move to the standby machine
Situation
The shop site shop.lab.test lives on a floating address — a VIP: the name points to the .100
address in the machines' network (a line in /etc/hosts on both machines, with the short name vip
there too). keepalived holds the address: normally it is on node1, and if node1 goes down, node2
should pick it up. Both machines run nginx with the same page, only each one is signed with its own
name: shop: served by node1 or shop: served by node2.
During a drill keepalived was stopped on node1 — this is how a machine going down looks to its neighbour. The address left node1, and the site vanished: nothing moved to node2.
node1 is your terminal. Run commands on node2 over SSH: ssh node2 'command', or log in with
ssh node2 and come back with exit. sudo works without a password on both machines. Where the
address is now and who answers on it:
ip -br a; ssh node2 ip -br a
curl -s http://shop.lab.test/
Task
- Normally the floating address is on node1, and only there; the site
http://shop.lab.test/answers with node1's page. - When keepalived stops on node1, within 10 seconds the address is on node2, and the site answers on it with node2's page.
- When keepalived is running on node1 again, within 10 seconds the address comes back to node1.
"Check" stops keepalived on node1 on its own, looks at where the address went and who answers on it, then starts keepalived again and waits for the address to come back. The check takes up to 40 seconds.
Constraints
- All of it must survive a reboot of both machines: the services are enabled, the settings are in files, and the running services have read those files after the change.
- Only keepalived manages the floating address: don't assign it by hand (
ip addr add) and don't put it into the network settings. - node1 stays the main machine: don't change its keepalived settings and don't hand the address to node2 for good.
There is no internet in the lab — only the network between node1 and node2, everything you need is installed. Run the drill yourself:
sudo systemctl stop keepalivedon node1, look at where the address is and what the site answers, thensudo systemctl start keepalived.
Lab goals
0 of 4-
Normally the floating address is on node1 and only there, and http://shop.lab.test/ answers with node1's page — not checked yet
-
When keepalived stops on node1, within 10 s the address is on node2 and the site answers on it with node2's page — not checked yet
-
When keepalived is running on node1 again, within 10 s the address comes back to node1 — not checked yet
-
keepalived and nginx on both machines are enabled and run with the settings from their files — all of it survives a reboot — not checked yet