LoadBalancing с Linux

</WebTech

Какво е това нещо LoadBalancer

Защо може да ми трябва подобно чудо

LoadBalancing с Linux

</WebTech

Видове LoadBalancing

Service

Server

Network

LoadBalancing с Linux

</WebTech

Service LoadBalancing

Web server balancing

Mail server balancing

DataBase server balancing

LoadBalancing с Linux

</WebTech

DNS Round-robin

+ clusters

+ SAN

+ друг вид Distributed

Network Storage

1

3

2

Кой използва тази технолагия?

DNS

WEB

WEB

WEB

www.site.com address 1

www.site.com address 1

www.site.com address 2

www.site.com address 3

LoadBalancing с Linux

</WebTech

Network LoadBalancing

Route (split access)

Route (multihomed)

Bonding(shared access)

Комбинация

LoadBalancing с Linux

</WebTech

Route (spit access)

/etc/iproute2/rt_tables

255 local	12	isp1

254 main	13	isp2

253 default

ip route add $LOCAL_NET dev $IF_LOCAL table isp1

ip route add $NET_ISP1 dev $IF_ISP1 table isp1

ip route add 0/0 via $GW_ISP1 table isp1

ip route add $LOCAL_NET dev $IF_LOCAL table isp2

ip route add $NET_ISP2 dev $IF_ISP2 table isp2

ip route add 0/0 via $GW_ISP2 table isp2

LoadBalancing с Linux

</WebTech

Route (spit access)

ip rule add from $IP_ISP1 table isp1

ip rule add from $IP_ISP2 table isp2

iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP \

–to $IP_ISP1

iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP \

–to $IP_ISP2

LoadBalancing с Linux

</WebTech

Route (multihomed)

ip route add 0/0 nexthop via $GW_ISP1 weight 1 \

nexthop via $GW_ISP2 weight 2

ip rule add from fwmask 1 table isp1

ip rule add from fwmask 2 table isp2

iptables -A POSTROUTING -t nat -m mark --mark 1 -j SNAT \ --to $IP_ISP1

iptables -A POSTROUTING -t nat -m mark --mark 2 -j SNAT \ --to $IP_ISP2

LoadBalancing с Linux

</WebTech

Route (multihomed)

iptables -t mangle -A POSTROUTING -j MARK --set-mark 1 \ -m state --state NEW -o $IF_ISP1

iptables -t mangle -A POSTROUTING -j MARK --set-mark 2 \ -m state --state NEW -o $IF_ISP2

iptables -t mangle -A POSTROUTING -j CONNMARK \

--save-mark -m state --state NEW

iptables -t mangle -A PREROUTING -j CONNMARK \

--restore-mark

LoadBalancing с Linux

</WebTech

Route (multihomed)

patch-o-matic-ng (преди 12.05.2006)

модули:

random

nth

LoadBalancing с Linux

</WebTech

Bonding (share load)

Какво е представлява

Какво може да прави

Настройки

Проблеми

LoadBalancing с Linux

</WebTech

Bonding (share load)

Нужен софтуер

# gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave

# cp ifenslave /sbin/ifenslave

Настройки

/etc/modules.conf	/etc/modprobe.conf

LoadBalancing с Linux

</WebTech

Bonding (share load)

Monitoring

arp_interval

arp_ip_mon

downdelay(ethernet)

miimon

Пример

alias bond0 bonding

options bond0 mode=balance-alb miimon=100	primary=eth0 updelay=50

LoadBalancing с Linux

</WebTech

Bonding (share load)

Type of bonding

mode 0 или balance-rr

mode 1 или active-backup

mode 2 или balance-xor

mode 3 или broadcast

mode 4 или 802.3ad(link agregation)

mode 5 или balance-tlb

mode 6 или balance-alb

LoadBalancing с Linux

</WebTech

Bonding (share load)

Проблемите

ограниченията на ethernet

arp_interval & arp_ip_target

missing interfaces

LoadBalancing с Linux

</WebTech

Комбинации

Bonding tunels за Българския трафик

Split access за Международният трафик

Проблемите

LoadBalancing с Linux

</WebTech

?	?	?	?	?	?

?	?	?	?

?	?	?	?	?

?	?	? Въпроси ?	?	?

?	?	?	?	?	?

?	?	?	?	?	?	?

?	?	?	?	?	?	?

?	?	?	?	?	?	?	?

Мариян Маринов mm@yuhu.biz

LoadBalancing with Linux

LoadBalancing with Linux

Load Balance Balancing LoadBalancing Linux

2006-04-16T01:36:19