Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:load_balancing_haproxy_and_keepalived [2018/04/09 00:14] billdozor [Reboots] |
linux_wiki:load_balancing_haproxy_and_keepalived [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 89: | Line 89: | ||
Official Site: http:// | Official Site: http:// | ||
+ | |||
+ | ==== Main Config ==== | ||
* Configure HA-Proxy (/ | * Configure HA-Proxy (/ | ||
* Remove all example frontend and backend config sections (leave default section) | * Remove all example frontend and backend config sections (leave default section) | ||
+ | * Add a section for the HAProxy Stats page< | ||
+ | # HAProxy Stats | ||
+ | # | ||
+ | listen stats | ||
+ | # SSL Mode and Cert | ||
+ | bind *:9000 ssl crt / | ||
+ | mode http | ||
+ | |||
+ | # Enable Stats and Hide Version | ||
+ | stats enable | ||
+ | stats hide-version | ||
+ | |||
+ | # Authentication realm. This can be set to anything. Escape space characters with a backslash. | ||
+ | stats realm HAProxy\ Statistics | ||
+ | |||
+ | # The virtual URL to access the stats page | ||
+ | stats uri / | ||
+ | |||
+ | # The user/pass you want to use. Change this password! | ||
+ | stats auth admin: | ||
+ | * The pem certificate file is a concatenation of the SSL key, cert, and certificate authority. Example< | ||
+ | |||
+ | ==== Frontend/ | ||
+ | |||
* Create new directory to hold frontend/ | * Create new directory to hold frontend/ | ||
* Create new frontend/ | * Create new frontend/ | ||
Line 147: | Line 173: | ||
OPTIONS=" | OPTIONS=" | ||
* Multiple config files example:< | * Multiple config files example:< | ||
+ | |||
+ | ==== Additional Config Examples ==== | ||
+ | |||
+ | **Session Persistence** | ||
+ | * Cookies: Application layer persistence (app needs to support cookies)< | ||
+ | balance | ||
+ | # Use Cookie for Session Persistence | ||
+ | cookie SERVERID insert indirect nocache | ||
+ | # fullconn: does nothing since we are not using minconn (just makes the dashboard less confusing) | ||
+ | fullconn 1000 | ||
+ | server | ||
+ | server | ||
+ | * Source IP: Affinity based on source IP hash (app doesn' | ||
+ | balance | ||
+ | # fullconn: does nothing since we are not using minconn (just makes the dashboard less confusing) | ||
+ | fullconn 1000 | ||
+ | server | ||
+ | server | ||
---- | ---- |