Skip to content

Instantly share code, notes, and snippets.

@slene
Created December 5, 2017 10:18
Show Gist options
  • Save slene/0feaa1e68adfaae1b7868871dd3c0196 to your computer and use it in GitHub Desktop.
Save slene/0feaa1e68adfaae1b7868871dd3c0196 to your computer and use it in GitHub Desktop.
haproxy
global
log 127.0.0.1 local0 debug
maxconn 65000
daemon
pidfile /var/run/haproxy.pid
nbproc 1
defaults
option dontlognull
option forwardfor
option http-server-close
option log-health-checks
option redispatch
retries 3
maxconn 10000
timeout check 5s
timeout connect 5s
timeout client 50s
timeout server 50s
log global
log-format {"type":"haproxy","timestamp":%Ts,"http_status":%ST,"http_request":"%r","remote_addr":"%ci","bytes_read":%B,"upstream_addr":"%si","backend_name":"%b","retries":%rc,"bytes_uploaded":%U,"upstream_response_time":"%Tr","upstream_connect_time":"%Tc","session_duration":"%Tt","termination_state":"%ts"}
default-server init-addr last,libc,none
listen haproxy_stats
bind 0.0.0.0:1080
mode http
log 127.0.0.1 local0 err
stats refresh 5s
stats uri /haproxy-stats
stats realm Haproxy\ Statistics
stats auth admin:admin
stats auth test:test
stats hide-version
stats admin if TRUE
bind-process 1
frontend http_in
bind 0.0.0.0:80
mode http
option httplog
option httpclose
default_backend http_in
backend http_in
mode http
option httpchk GET /
server-template http 1-3 web.service.cloud.test.com:80 resolve-prefer ipv4 check observe layer7 resolvers consul-dns inter 1s rise 9 fall 86400000 error-limit 86400000 weight 1
resolvers consul-dns
nameserver dns1 192.168.1.11:53
nameserver dns2 192.168.1.12:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold other 2s
hold refused 2s
hold nx 2s
hold timeout 2s
hold valid 0s
hold obsolete 2s
Dec 5 10:12:08 n1 haproxy[1]: Proxy haproxy_stats started.
Dec 5 10:12:08 n1 haproxy[1]: Proxy http_in started.
Dec 5 10:12:08 n1 haproxy[1]: Proxy http_in started.
Dec 5 10:12:08 n1 haproxy[6]: Health check for server http_in/http1 succeeded, reason: Layer7 check passed, code: 200, info: "OK", check duration: 87ms, status: 86400000/86400000 UP.
Dec 5 10:12:08 n1 haproxy[6]: Health check for server http_in/http2 succeeded, reason: Layer7 check passed, code: 200, info: "OK", check duration: 87ms, status: 86400000/86400000 UP.
Dec 5 10:12:09 n1 haproxy[6]: Health check for server http_in/http3 succeeded, reason: Layer7 check passed, code: 200, info: "OK", check duration: 111ms, status: 86400000/86400000 UP.
Message from syslogd@n1 at Dec 5 10:12:10 ...
haproxy[6]: backend http_in has no server available!
Dec 5 10:12:10 n1 haproxy[6]: Server http_in/http1 is going DOWN for maintenance (DNS NX status). 2 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Dec 5 10:12:10 n1 haproxy[6]: Server http_in/http2 is going DOWN for maintenance (DNS NX status). 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Dec 5 10:12:10 n1 haproxy[6]: Server http_in/http3 is going DOWN for maintenance (DNS NX status). 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Dec 5 10:12:10 n1 haproxy[6]: backend http_in has no server available!
Dec 5 10:12:30 n1 haproxy[6]: http_in/http1 changed its IP from 220.250.64.225 to 192.168.98.21 by consul-dns/dns1.
Dec 5 10:12:30 n1 haproxy[6]: Server http_in/http1 administratively READY thanks to valid DNS answer.
Dec 5 10:12:30 n1 haproxy[6]: http_in/http2 changed its IP from 220.250.64.225 to 192.168.98.5 by DNS cache.
Dec 5 10:12:30 n1 haproxy[6]: Server http_in/http2 administratively READY thanks to valid DNS answer.
Dec 5 10:12:30 n1 haproxy[6]: Server http_in/http1 ('web.service.cloud.test.com') is UP/READY (resolves again).
Dec 5 10:12:30 n1 haproxy[6]: Server http_in/http2 ('web.service.cloud.test.com') is UP/READY (resolves again).
Dec 5 10:12:30 n1 haproxy[6]: Health check for server http_in/http1 failed, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms, status: 0/9 DOWN.
Dec 5 10:12:30 n1 haproxy[6]: Server http_in/http1 is DOWN. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Dec 5 10:12:31 n1 haproxy[6]: Health check for server http_in/http2 failed, reason: Layer4 connection problem, info: "Connection refused", check duration: 1ms, status: 0/9 DOWN.
Message from syslogd@n1 at Dec 5 10:12:31 ...
haproxy[6]: backend http_in has no server available!
Dec 5 10:12:31 n1 haproxy[6]: Server http_in/http2 is DOWN. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Dec 5 10:12:31 n1 haproxy[6]: backend http_in has no server available!
Dec 5 10:12:48 n1 haproxy[6]: Health check for server http_in/http2 failed, reason: Layer4 timeout, check duration: 1002ms, status: 0/9 DOWN.
Dec 5 10:12:48 n1 haproxy[6]: Health check for server http_in/http1 failed, reason: Layer4 timeout, check duration: 1001ms, status: 0/9 DOWN.
Dec 5 10:12:49 n1 haproxy[6]: Server http_in/http1 was DOWN and now enters maintenance (DNS NX status).
Dec 5 10:12:49 n1 haproxy[6]: Server http_in/http2 was DOWN and now enters maintenance (DNS NX status).
@slene
Copy link
Author

slene commented Dec 6, 2017

enter wrong state
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment