Implement lab3 load balancing and failover

This commit is contained in:
Ilia Sokolov
2026-10-31 17:19:05 +03:00
parent 0ab3a341aa
commit 06d47fbb5b
27 changed files with 2438 additions and 25 deletions
+11
View File
@@ -0,0 +1,11 @@
@echo off
rem Stops exactly ONE API replica: the container whose hostname equals TARGET_INSTANCE_ID (X-Instance-Id).
rem Leaves it stopped; DB, LB and volumes are untouched. Restore separately: docker compose up -d
setlocal
if "%TARGET_INSTANCE_ID%"=="" exit /b 2
cd /d "%~dp0.." || exit /b 1
set "CID="
for /f %%i in ('docker ps -q --filter "id=%TARGET_INSTANCE_ID%" --filter "label=com.docker.compose.service=api"') do if not defined CID set "CID=%%i"
if not defined CID exit /b 1
docker stop --time 5 %CID% >nul 2>&1
exit /b %errorlevel%