free enterpriseloadbalancer

25
The Free Enterprise Load Balancer Mike Soule

Upload: mikesoule

Post on 29-Jun-2015

359 views

Category:

Documents


0 download

TRANSCRIPT

  • 1. The Free EnterpriseLoad BalancerMike Soule

2. Goals High Availability Scalability Performance Maintainability 3. Goals: Fromwww 4. Goals: Tobalancerwww www www 5. Web Server Preparation Three Identical Web Servers- IPs: 10.47.47.101-103- Default page (index.html) to identifywhich web server- Open http port (80) 6. Web Server Preparation 7. Load Balancer Preparation Load Balancer Server- CentOS 7 minimal- IP: 10.47.47.11- Packages: httpd mod_ssl openssl- Ports: http, https (80, 443)# yum install httpd mod_ssl openssl# firewall-cmd --permanent --add-service=http# firewall-cmd --permanent --add-service=https# firewall-cmd --reload 8. Configure Web Server Pool Using mod_proxy_balancer- Included in default Apache install# vim /etc/httpd/conf.d/proxy_balancer.confBalancerMember http://10.47.47.101:80BalancerMember http://10.47.47.102:80BalancerMember http://10.47.47.103:80ProxySet timeout=300ProxyPass / balancer://www-cluster 9. SELinux New files in /etc/httpd may causeerrors due to SELinux contexts Disabling SELinux is NEVER theanswer! A few minutes of Google-ing will reveala solution# restorecon -RvF /etc/httpd/ 10. Test and Start Apache# apachectl configtest# systemctl enable httpd# systemctl start httpd 11. The Balancer Manager Balancer Manager is a built-in webinterface for managing the web serverpool Status checks must be enabled# vim /etc/httpd/conf.d/status.confExtendedStatus OnSetHandler server-statusRequire host localhost 12. The Balancer Manager Enable the balancer manager# vim /etc/httpd/conf.d/proxy_balancer.conf Add before other ProxyPass directiveProxyPass /balancer-manager ! Add under Proxy Pass directivesSetHandler balancer-manager 13. But wait, we created asingle point of failure#OMGWTFBBQ! 14. Single Point of Failurebalancerwww www www 15. Clustered Load Balancersbalancer balancerwww www www 16. Clustered Load Balancersbalancer balancerwww www www 17. Clustered Load Balancers IP of new server: 10.47.47.12 Setup on both load balancers# yum install pcs# firewall-cmd --permanent --add-service=high-availability# firewall-cmd reload# echo 10.47.47.11 bar-lb-01 >> vim /etc/hosts# echo 10.47.47.12 bar-lb-02 >> vim /etc/hosts 18. Pacemaker Config System Set a password for the hacluster user(on both load balancers)# passwd hacluster Set boot services and start pcs (onboth load balancers)# systemctl disable httpd# systemctl stop httpd# systemctl enable pcsd# systemctl start pcsd 19. Starting the Cluster From here, all commands on one loadbalancer only (they will be automaticallyreplicated to the second load balancer)# pcs cluster auth bar-lb-01 bar-lb-02 -u hacluster# pcs cluster setup --name lb-cluster bar-lb-01 bar-lb-02# pcs cluster start --all 20. Two-node Cluster Setup Global cluster settings# pcs property set stonith-enabled=false# pcs property set no-quorum-policy=ignore# pcs property set default-resource-stickiness=1# pcs property set start-failure-is-fatal=false# pcs property set stop-orphan-actions=true# pcs property set stop-orphan-resources=true# pcs resource defaults migration-threshold=1# pcs resource op defaults timeout=60s 21. Cluster Resources Shared IP Address (10.47.47.10)# pcs resource create ClusterIP IPaddr2 ip=10.47.47.10cidr_netmask=32 op monitor interval=15s Apache# pcs resource create ApacheLB apache paramsconfigfile=/etc/httpd/conf/httpd.confstatusurl="http://localhost/server-status" op monitorinterval=30s 22. Resource Sanity Resource location and order sanity# pcs property set symmetric-cluster=true# pcs constraint order set ClusterIP ApacheLB# pcs constraint colocation add ApacheLB with ClusterIPscore=INFINITY 23. Review and Test View the cluster status# pcs status View the cluster config# pcs config Test failover# pcs cluster standby # pcs cluster unstandby 24. Cluster Web UI https://10.47.47.11:2224/