Runbook vs Playbook (concise):- Runbook: A step-by-step, low-ambiguity operational procedure for a specific condition (what to do). Targeted at on-call engineers to resolve known failures safely and quickly.- Playbook: Higher-level decision framework that includes diagnostics, multiple remediation paths, escalation criteria, and business context (how and when to choose actions). Often references multiple runbooks.Example runbook entry — "database-primary-unavailable"Metadata:- owner: db-sre-team- last-tested: 2025-10-01- risk-level: high- contact: oncall-db@company.com; Pager: #db-oncallSymptom:- Primary DB is unreachable or read/write errors from apps; alert: DB_PRIMARY_DOWNPre-Preconditions / Safety:- Ensure you have access to runbook, cluster credentials, and maintenance window if required.- Notify stakeholders if estimated recovery >15min.- Do NOT failover if transaction replication lag > 5s unless instructed.Steps:1) Confirm alert and scope- Check alert details and timestamp.- Verify primary status:bash
kubectl exec -it svc/db-admin -- pg_isready -h primary.db.cluster
# or run cloud provider console check
2) Quick health checks- Check primary host ping, system load, disk:bash
ssh db-primary "uptime; df -h /var/lib/postgresql; journalctl -u postgresql -n 200 --no-pager | tail -n 50"
- Check replication lag on a replica:bash
psql -h replica1 -c "SELECT now()-pg_last_xact_replay_timestamp() AS lag;"
3) If process crashed but host healthy- Attempt safe restart:bash
ssh db-primary "sudo systemctl start postgresql"
- Wait 30s, re-run pg_isready and check application error rate.4) If primary host unreachable or data corruption suspected- Initiate controlled failover (only if replication lag <=5s and read-only replicas healthy):bash
# use orchestrator/tooling:
orchestrator -c failover --candidate replica1 --force
- Monitor failover progress and application connections.5) Post-action verification- Verify new primary accepts writes:bash
psql -h new-primary -c "CREATE TEMP TABLE t(id int); INSERT INTO t VALUES(1); SELECT * FROM t;"
- Confirm replication from new primary to other replicas and app error rate returns to baseline.6) Escalation- If failover fails or data inconsistency: page senior DB engineer and engineering manager; mark incident Sev1.Rollback / Cleanup:- If original primary recovers, do NOT auto-promote back; follow controlled rejoin procedure documented in db-rejoin runbook.What must appear on every runbook entry:- Title and clear trigger/symptom- Owner and contact info- Last-tested date- Risk-level (low/medium/high)- Preconditions and safety checks- Step-by-step actions with exact commands- Verification steps and success criteria- Escalation path and rollback guidance- Links to related docs/playbooks and post-incident review template