Skip to content

Latest commit

 

History

History
75 lines (63 loc) · 3.37 KB

README.md

File metadata and controls

75 lines (63 loc) · 3.37 KB

HAProxy (with rsyslogd) and Keepalived in Docker

Quick start

# Start 5 web servers with 2 proxy servers
docker-compose up -d --scale web=5 --scale proxy=2
# show logs of the proxy container
docker-compose logs -f proxy
# Access the virtual IP specified in docker-compose.yml
curl -v 172.18.0.101
# Access Statistics Report
curl -v 172.18.0.101:8080

Testing

# Stop the proxy container in MASTER state
docker stop docker-haproxy_proxy_1
curl -v 172.18.0.101

# Then start it again
#   The priority in keepalived.conf is a random integer so that
#   the container might enter MASTER or BACKUP state which depends
#   on the priority is higher or lower than the priority in another
#   proxy container
docker start docker-haproxy_proxy_1
curl -v 172.18.0.101

Environment

$ cat /etc/redhat-release
CentOS Linux release 7.6.1810

$ docker --version
Docker version 1.13.1, build 7f2769b/1.13.1

$ docker-compose --version
docker-compose version 1.24.1, build 4667896b

$ docker images --format "{{.Repository}}:{{.Tag}}"
docker.io/nginx:1.17.3-alpine
docker.io/haproxy:2.0.7-alpine

Details

Reference