gang-tetris / test-services-integration-test

Integration test for services example
MIT License
0 stars 0 forks source link

Include clustered balancer #5

Open definability opened 8 years ago

definability commented 8 years ago

We need frontend to not care aboud backend servers — it should send queries to one IP/hostname even when some web-servers failed.

definability commented 8 years ago

Using HAProxy Docker https://hub.docker.com/_/haproxy/ and Neo4J documentation for configuring HAProxy http://neo4j.com/docs/stable/ha-haproxy.html

created own config file

global
    daemon
    maxconn 256

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http-in
    bind *:80
    default_backend s

backend s
    server s1 s1:8080 maxconn 32
    server s2 s2:8080 maxconn 32
definability commented 8 years ago

Docker

FROM haproxy:1.6
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

should be built from the directory with config and can be check via following script, when servers s1 and s2 are up

docker run -it --rm --name haproxy-syntax-check --link s1:s1 --link s2:s2 gangtetris/haproxy:1.6 haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg

After that you can execute it

docker run --rm --name haproxy --link s1:s1 --link s2:s2 gangtetris/haproxy:1.6
definability commented 8 years ago

Need to enable heartbeat with corrections to config

backend s
    option httpchk GET /ping
    server s1 s1:8080 maxconn 32 check
    server s2 s2:8080 maxconn 32 check
definability commented 8 years ago

Corosync http://robert.penz.name/386/howto-setup-a-haproxy-as-fault-tolerant-high-available-load-balancer-for-multiple-caching-web-proxies-on-rhelcentossl/

definability commented 8 years ago

Docker Swarm https://docs.docker.com/swarm/install-w-machine/#create-three-vms-running-docker-engine http://devopscube.com/how-to-setup-and-configure-docker-swarm-cluster/ restart=always https://docs.docker.com/engine/admin/host_integration/

definability commented 8 years ago

Keepalived https://www.digitalocean.com/community/tutorials/how-to-set-up-highly-available-haproxy-servers-with-keepalived-and-floating-ips-on-ubuntu-14-04 http://serverfault.com/questions/238605/is-it-possible-to-make-redundancy-on-haproxy-server https://andyleonard.com/2011/02/01/haproxy-and-keepalived-example-configuration/ https://www.howtoforge.com/setting-up-a-high-availability-load-balancer-with-haproxy-keepalived-on-debian-lenny-p2