Linux Labs

SRE practices: SLOs, incidents, redundancy / Final lab

On-call shift

hard ~50 min
Not running Starting usually ~20 s
Report a problem

Situation

You are taking over the on-call shift. The order site shop.lab.test runs on two machines. Users open it by the name shop.lab.test — a floating address (VIP) kept by keepalived: node1 is the primary machine, node2 is the standby. node1 runs the nginx balancer and Prometheus, which scrapes both machines. node2 runs two application backends (the lab-shop@8081 and lab-shop@8082 services), PostgreSQL with the shop database and a separate /var/log/shop volume for the application logs.

Last night the previous shift changed things on both machines. A few minutes ago the complaints started: the site shows no orders. The previous on-call engineer managed to pass on two more things: node2 is running out of space, and the alert rule that was supposed to warn about it never showed up in Prometheus. The site runbook is /srv/runbooks/shop-down.md on node1.

node1 is your terminal. Run commands on node2 over SSH: ssh node2 'command', or open a shell there — ssh node2, and exit to come back. sudo works without a password on both machines. There is no browser to the machines: look at the site and at Prometheus from the terminal — curl, jq, promtool.

Task

Bring the site back to the users first, then deal with the rest.

  1. http://shop.lab.test/ on the floating address returns the order list from the database — for every request. As intended, node1 holds the address, and keepalived runs on both machines.
  2. Only the application (the shop role) connects to the shop database. That requirement was introduced yesterday and it stays: the report role is not let into the shop database.
  3. The /var/log/shop volume on node2 is less than 80 % full, and the application log grows the same way as before last night's changes.
  4. The LogVolumeAlmostFull rule from /etc/prometheus/rules/ is loaded into Prometheus.
  5. ~/postmortem.md on node1 holds the incident review with three sections: - ## Timeline — at least three events, one line each: HH:MM:SS what happened (machine time, UTC, as in the logs). One of them is the moment the site stopped returning the orders; - ## Root cause — what exactly broke: every fault you found; - ## Action items — what to do so that it does not happen again, at least one item.

"Check" itself sends 20 requests to the site on the floating address and 20 to each backend on node2 (to see how much the application log grows). The check takes about 10 seconds.

Constraints

  • Everything must survive a reboot of both machines: services are enabled, settings live in files, and the running services have re-read those files after your edits.
  • Do not move the floating address to node2 and do not turn keepalived off: the standby is there for a real failure.
  • /var/log/shop stays a separate volume from /etc/fstab.

There is no internet in the lab — only the network between node1 and node2, everything you need is installed. The machines' logs use UTC.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 5
  • http://shop.lab.test/ on the floating address returns the orders from the database for each of 20 requests; node1 holds the address, keepalived runs on both machines — not checked yet
  • The application connects to the shop database while the report role is refused — the database is the application's only; pg_hba.conf has no errors and PostgreSQL has reloaded it — not checked yet
  • The /var/log/shop volume on node2 is less than 80 % full, the application log grows as it did before the changes, the backends run with the settings from /etc/default/shop — not checked yet
  • The LogVolumeAlmostFull rule is loaded into Prometheus from its file, and the last configuration reload succeeded — not checked yet
  • ~/postmortem.md on node1 has a Timeline with the outage start time from the logs, a Root cause naming every fault you found, and Action items — not checked yet

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…