ha of load balancer
DESCRIPTION
TRANSCRIPT
![Page 2: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/2.jpg)
Agenda • Why?
–DNS RoundRobin
• Dedicated Server in IDC
–Hardware L4
–Using VIP
• AWS
–Using EIP
![Page 3: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/3.jpg)
Why? • Let’s see in beginner’s point of view.
– How to distribute clients’ requests.
CLIENT
CLIENT
CLIENT
CLIENT
Web Server
Web Server DB
Using DNS RR
![Page 4: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/4.jpg)
Why? • Let’s see in beginner’s point of view.
– How to distribute clients’ requests.
– But If one web server dies, half requests will fail.
– And DNS RR needs lots of propagation time.
CLIENT
CLIENT
CLIENT
CLIENT
Web Server
Web Server DB
Using DNS RR
![Page 5: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/5.jpg)
Load Balancer! • LB distributes clients’ requests.
CLIENT
CLIENT
CLIENT
CLIENT
Web
Web DB
Using Load Balancer
LB
![Page 6: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/6.jpg)
Load Balancer! • LB distributes clients’ requests.
– If one web server dies, LB will get rid of failed server.
CLIENT
CLIENT
CLIENT
CLIENT
Web
Web DB
Using Load Balancer
LB
![Page 7: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/7.jpg)
Load Balancer FAIL • If LB dies, It is critical disaster.
– So we need HA of Load Balancer.
CLIENT
CLIENT
CLIENT
CLIENT
Web
Web DB
Using Load Balancer
LB
![Page 8: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/8.jpg)
How? • How to HA of LB
– It depends on your situation.
• Question?
– Where do you host your service?
• IDC, aws
• Let’s go to build.
![Page 9: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/9.jpg)
Dedicated Server in IDC • Using Hardware L4
– Could your hosting service support Hardware L4
– Pros
• The easiest way to manage
– Cons
• Expensive solution.
• Using VIP
– With HAProxy or Nginx
![Page 10: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/10.jpg)
Hardware L4 #1 • You can choose 2 types of solution.
• Using L4 as LB
CLIENT
CLIENT
CLIENT
CLIENT
Web
Web DB
Using Hardware L4 #1
L4
![Page 11: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/11.jpg)
Hardware L4 #2 • Using L4 with LB
– Hardware L4 can fail, but rarely
CLIENT
CLIENT
CLIENT
CLIENT
Web
Web DB
Using Hardware L4 #2
L4 LB
LB
![Page 12: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/12.jpg)
Using VIP • Virtual IP Address
Route
1.1.1.2 1.1.1.3 1.1.1.4
CLIENT 1.1.1.4
1.1.1.2
1.1.1.4 is VIP which is allocated 1.1.1.2
![Page 13: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/13.jpg)
Using VIP • We can give VIP to other Server.
Route
1.1.1.2 1.1.1.3 1.1.1.4
CLIENT 1.1.1.4
1.1.1.4 is VIP which is allocated 1.1.1.2
![Page 14: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/14.jpg)
Software LB with Keepalived • Virtual IP Address( HAProxy, Nginx doesn’t matter )
LB1 192.168.1.3
192.168.1.2
LB2 192.168.1.4
Haproxy keepalived
Haproxy keepalived
Web 192.168.1.10
Web 192.168.1.11
Web 192.168.1.12
DB 192.168.1.100
![Page 15: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/15.jpg)
Software LB with Keepalived • But you have to check failover time.
LB1 192.168.1.3
192.168.1.2
LB2 192.168.1.4
Haproxy keepalived
Haproxy keepalived
Web 192.168.1.10
Web 192.168.1.11
Web 192.168.1.12
DB 192.168.1.100
Keepalived checks each other. And LB2 Keepalived reassign VIP to oneself.
![Page 16: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/16.jpg)
Software LB with Keepalived • Link
– HAProxy with keepalived
• http://haproxy.1wt.eu/download/1.3/doc/architecture.txt
• http://andyleonard.com/2011/02/01/haproxy-and-keepalived-example-configuration/
• http://aaronwalrath.wordpress.com/2011/06/28/configure-haproxy-and-keepalived-for-load-balancing-and-reverse-proxy-on-red-hatscientificcentos-linux-56/
– Nginx with keepalived
• http://www.cyberciti.biz/faq/handling-nginx-failover-with-keepalived/
• http://evolution.voxeo.com/wiki/kb:swloadbalancingfailover
![Page 17: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/17.jpg)
AWS • What are different from IDC
– You can’t use Hardware L4
– You can’t use multicast
– You can’t use VIP
• How?
– ELB( Elastic Load Balancer )
– EIP( Elastic IP )
![Page 18: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/18.jpg)
ELB • Auto Scaling is possible.
• ELB doesn’t support Fixed IP.
CLIENT
CLIENT
CLIENT
CLIENT
EC2 Instance
EC2 Instance ELB
![Page 19: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/19.jpg)
EIP • Elastic IP Address
• We can associate and release EIP like VIP
![Page 20: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/20.jpg)
Weakness of ELB,EIP • Whenever we use it, we have to pay.
– It is external IP.
• And it is impossible to apply ELB,EIP in AWS internal networks.
![Page 21: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/21.jpg)
How to Handle in AWS? • There is no Silver Bullet.
• DNS based Solution
– Using Dynamic DNS Server for internal Network.
– Using short TTL.
![Page 22: Ha of load balancer](https://reader031.vdocuments.net/reader031/viewer/2022013114/548408d15806b5a9588b45b1/html5/thumbnails/22.jpg)
Thank you!