Лабораторная 3 - Костылев - БПИ2303 - на 5 #151
@@ -5,6 +5,7 @@ replicas() {
|
|||||||
docker inspect -f '{{.Config.Hostname}} {{.State.Status}} started={{.State.StartedAt}} finished={{.State.FinishedAt}}' $(docker compose ps -aq "${API_SERVICE:-api}")
|
docker inspect -f '{{.Config.Hostname}} {{.State.Status}} started={{.State.StartedAt}} finished={{.State.FinishedAt}}' $(docker compose ps -aq "${API_SERVICE:-api}")
|
||||||
}
|
}
|
||||||
tmp=evidence/failover.tmp
|
tmp=evidence/failover.tmp
|
||||||
|
since=$(date -u +%FT%TZ)
|
||||||
{
|
{
|
||||||
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD)"
|
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD)"
|
||||||
echo "== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt"
|
echo "== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt"
|
||||||
@@ -16,8 +17,8 @@ tmp=evidence/failover.tmp
|
|||||||
} > "$tmp" 2>&1
|
} > "$tmp" 2>&1
|
||||||
stopped=$(replicas | awk '$2 == "exited" {print $1}')
|
stopped=$(replicas | awk '$2 == "exited" {print $1}')
|
||||||
{
|
{
|
||||||
echo "== stopped replica: $stopped; last log lines of its process"
|
echo "== stopped replica: $stopped; shutdown: signal, drain window with readiness 503, close, exit"
|
||||||
docker logs --tail 6 "$stopped" 2>&1
|
docker logs --since "$since" "$stopped" 2>&1 | grep -E 'Handling signal|Draining|"status":503|Shutting down|Waiting for conn|Finished server|service.stopped|SIGTERM' | tail -16
|
||||||
echo "\$ scripts/restore.sh"
|
echo "\$ scripts/restore.sh"
|
||||||
scripts/restore.sh
|
scripts/restore.sh
|
||||||
echo "== after restore"
|
echo "== after restore"
|
||||||
|
|||||||
Reference in New Issue
Block a user