Loadbalancing cez HAProxy je na L3 urovni ak sa nemylim... Cez NGX, Apache, etc sa riesi load balancing na L7.
Si zober napriklad session stickness... U nas moze konkretna sesna smerovat len na konkrent pool serverov. Ako vzdy je vsetko SSL a HAProxy ho neterminuje a teda netusi o aku sesnu sa jedna. Preto je celkom idelane riesenie --> request --> Firewall --> L2 loadbalancer --> L7 loadbalancer --> App server
Kedze tu asi netreba riesit moc, stacilo by L7 LB. Sample config ngx:
upstream xxxxxxxx {
server xxxxxxxx:80 weight=300 srun_id=xxxxxxxx;
server xxxxxxxx:80 weight=400 srun_id=xxxxxxxx;
server xxxxxxxx:80 weight=400 srun_id=xxxxxxxx;
server xxxxxxxx:80 weight=500 srun_id=xxxxxxxx;
server xxxxxxxx:80 weight=500 srun_id=xxxxxxxx;
#
jvm_route $cookie_JSESSIONID reverse;
}
# Main HTTP redirect
server {
listen 80;
server_name _;
access_log /var/log/nginx/http.access.log;
server_name_in_redirect off;
location / {
rewrite ^(.*) https://$host$1 permanent;
}
}
# xxxxxxxx HTTPS loadbalanced
server {
listen xxxxxxxx:443;
listen xxxxxxxx:443;
server_name _;
ssl on;
ssl_certificate /etc/nginx/ssl/wc.xxxxxxxx.crt;
ssl_certificate_key /etc/nginx/ssl/wc.xxxxxxxx.key;
ssl_session_timeout 30m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/https.access.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Server $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-FORWARDED_PROTO https;
proxy_pass
http://xxxxxxxx/; }
}