HAProxy
Jump to navigation
Jump to search
HAProxy yra nemokamas, labai greitas ir patogus sprendimas siūlantis aukšto pasiekiamumo ir resursų balancavimo bei proxy sprendimus TCP ir HTTP-paremtoms aplikacijoms. Sukurtas aptarnauti labai apkrautas internetines svetaines, aptarnauja pasaulyje labiausiai lankomas. Per metų metus tapo de-facto standartiniu atviro kodo resursų balanceriu, leidžiamu su populiariausiomis Linux distribucijomis ir naudojamas populiarausiose debesų platformose. Nesireklamuojantis įrankis, kurį žino tiktai administratoriai :-)
- https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps
- https://lesterchan.net/blog/2015/05/18/getting-real-ip-for-nginx-blocking-ip-on-haproxy/
WebSocket[keisti]
frontend websocket bind *:8890 ssl crt /etc/ssl/org/fullchain.pem tcp-request inspect-delay 500ms tcp-request content accept if HTTP default_backend nodes_websocket frontend mysql backend nodes_websocket mode http option forwardfor option http-server-close option forceclose no option httpclose cookie SRVNAME insert server app2 10.36.36.9:8890 cookie S2 check server app3 10.36.36.10:8890 cookie S3 check
Nginx[keisti]
frontend nginx bind *:80 bind *:443 ssl crt /etc/ssl/org/fullchain.pem redirect scheme https if !{ ssl_fc } # jeigu ne https force redirectas mode http maxconn 10000 stats enable # statistikos stats uri /haproxy?stats # stats realm Strictly\ Private # stats auth A_Username:YourPassword # stats auth Another_User:passwd default_backend nodes_nginx backend nodes_nginx mode http balance roundrobin option forwardfor cookie SRVNAME insert server app2 10.36.36.9:80 cookie S2 check server app3 10.36.36.10:80 cookie S3 check http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc }
MySQL[keisti]
MySQL serveriuose sukuriam haproxy_check vartotoja:
uninstall plugin validate_password; create user 'haproxy_check'@'10.36.36.8';
frontend mysql bind 10.36.36.8:3307 mode tcp default_backend nodes_mysql backend nodes_mysql mode tcp option tcpka option mysql-check user haproxy_check balance roundrobin server app2 10.36.36.9:3306 check server app3 10.36.36.10:3306 check