# Сохранность после перезапуска хранилищ и отказ API Предпосылки: подготовленный, разблокированный учебный стенд; Docker Compose, Python и локальный CA. `sleep 60` Код завершения: 0. ```text ``` `make test-persistence ACTION_SCRIPT=scripts/restart.sh CA_FILE=secrets/tls/lab7-ca.crt` Код завершения: 0. ```text python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "https://localhost:8443" --ca-file "secrets/tls/lab7-ca.crt" Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. ``` `make test-failover ACTION_SCRIPT=scripts/stop-one.sh CA_FILE=secrets/tls/lab7-ca.crt` Код завершения: 0. ```text python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://localhost:8443" --ca-file "secrets/tls/lab7-ca.crt" Executing explicit failover hook; hook output suppressed to avoid leaking secrets. {"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 1, "first_recovery_seconds": 1.454} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. ``` `docker compose start api` Код завершения: 0. ```text Container highload-lab7-db-1 Waiting Container highload-lab7-s3-1 Waiting Container highload-lab7-redis-1 Waiting Container highload-lab7-s3-1 Healthy Container highload-lab7-redis-1 Healthy Container highload-lab7-db-1 Healthy Container highload-lab7-s3-bootstrap-1 Starting Container highload-lab7-migrate-1 Starting Container highload-lab7-s3-bootstrap-1 Started Container highload-lab7-s3-bootstrap-1 Waiting Container highload-lab7-migrate-1 Started Container highload-lab7-migrate-1 Waiting Container highload-lab7-migrate-1 Exited Container highload-lab7-s3-bootstrap-1 Exited Container highload-lab7-api-1 Starting Container highload-lab7-api-1 Started ``` `./scripts/wait_ingress.sh` Код завершения: 0. ```text ``` `sleep 60` Код завершения: 0. ```text ``` `make test-failover ACTION_SCRIPT=scripts/stop-one.sh CA_FILE=secrets/tls/lab7-ca.crt` Код завершения: 0. ```text python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://localhost:8443" --ca-file "secrets/tls/lab7-ca.crt" Executing explicit failover hook; hook output suppressed to avoid leaking secrets. {"observed_instances_before": 2, "successful_writes": 122, "failed_attempts": 2, "first_recovery_seconds": 1.58} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. ``` `docker compose start api` Код завершения: 0. ```text Container highload-lab7-redis-1 Waiting Container highload-lab7-s3-1 Waiting Container highload-lab7-db-1 Waiting Container highload-lab7-s3-1 Healthy Container highload-lab7-s3-bootstrap-1 Starting Container highload-lab7-redis-1 Healthy Container highload-lab7-db-1 Healthy Container highload-lab7-migrate-1 Starting Container highload-lab7-s3-bootstrap-1 Started Container highload-lab7-s3-bootstrap-1 Waiting Container highload-lab7-migrate-1 Started Container highload-lab7-migrate-1 Waiting Container highload-lab7-migrate-1 Exited Container highload-lab7-s3-bootstrap-1 Exited Container highload-lab7-api-1 Starting Container highload-lab7-api-1 Started ``` `./scripts/wait_ingress.sh` Код завершения: 0. ```text ``` Состояния контейнеров (restart): ```text /highload-lab7-api-1 2026-11-14T17:24:55.651185572Z /highload-lab7-api-2 2026-11-14T17:24:55.819757058Z /highload-lab7-broker-1 2026-11-14T17:23:53.398757712Z /highload-lab7-db-1 2026-11-14T17:23:50.651938319Z /highload-lab7-redis-1 2026-11-14T17:23:50.615434358Z /highload-lab7-s3-1 2026-11-14T17:23:50.777141988Z /highload-lab7-api-1 2026-11-14T17:26:42.238931046Z /highload-lab7-api-2 2026-11-14T17:26:42.256578225Z /highload-lab7-broker-1 2026-11-14T17:26:34.665663438Z /highload-lab7-db-1 2026-11-14T17:26:33.677826831Z /highload-lab7-redis-1 2026-11-14T17:26:33.695777808Z /highload-lab7-s3-1 2026-11-14T17:26:33.780920926Z ``` Состояния контейнеров (failover): ```text /highload-lab7-api-1 exited /highload-lab7-api-1 exited ``` Итог: все команды завершились успешно.