ha of load balancer

22
HA of Load Balancer for Small Company [email protected]

Upload: dae-myung-kang

Post on 07-Dec-2014

3.070 views

Category:

Documents


6 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Ha of load balancer

HA of Load Balancer for Small Company

[email protected]

Page 2: Ha of load balancer

Agenda • Why?

–DNS RoundRobin

• Dedicated Server in IDC

–Hardware L4

–Using VIP

• AWS

–Using EIP

Page 3: Ha of load balancer

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

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

Load Balancer! • LB distributes clients’ requests.

CLIENT

CLIENT

CLIENT

CLIENT

Web

Web DB

Using Load Balancer

LB

Page 6: Ha of load balancer

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

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

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

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

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

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

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

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

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

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

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

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

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

EIP • Elastic IP Address

• We can associate and release EIP like VIP

Page 20: Ha of load balancer

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

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

Thank you!