forked from mtusi2026/mtusi2026lab3
Реализовать lab3 на оценку 4: HAProxy, реплики API и общая идемпотентность.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# Lab3 load balancer: round-robin across Compose DNS name "api" (all replicas).
|
||||
global
|
||||
maxconn 2048
|
||||
log stdout format raw local0
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option dontlognull
|
||||
timeout connect 3s
|
||||
timeout client 30s
|
||||
timeout server 30s
|
||||
timeout check 2s
|
||||
timeout http-request 10s
|
||||
retries 2
|
||||
|
||||
resolvers docker
|
||||
nameserver dns1 127.0.0.11:53
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 5s
|
||||
hold obsolete 10s
|
||||
|
||||
frontend messenger_fe
|
||||
bind *:8080
|
||||
acl is_lb_live path /__lb/live
|
||||
http-request return status 200 content-type text/plain string ok if is_lb_live
|
||||
default_backend messenger_api
|
||||
|
||||
backend messenger_api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
# server-template expands A records for Compose service DNS name "api".
|
||||
# inter=2s fall=2 → typically ≤4s to mark a backend down after failed checks.
|
||||
server-template api 8 api:8080 check inter 2s fall 2 rise 1 resolvers docker resolve-prefer ipv4 init-addr none
|
||||
Reference in New Issue
Block a user