Load balancing three models (httpd + lvs hundreds of thousands of concurrent load balancing structures)

First, several common load balancing model

Second, build httpd + lvs

LVS
1.node01
启动一块eth0:2的网卡子接口(ifconfig eth0:2 down可以把网卡down掉)
ifconfig eth0:2 192.168.118.100/24
2.node02-03
修改内核协议
cd /proc/sys/net/ipv4/conf/eth0
echo 1 > arp_ignore
echo 2 > arp_announce
cd ../all
echo 1 > arp_ignore
echo 2 > arp_announce
启动网卡lo:2子接口
ifconfig lo:2 192.168.118.100 netmask 255.255.255.255
3.安装httpd
node02-03
yum install httpd -y
service httpd start
vi /var/www/html/index.html 写一个主页
4.配置ipvsadm
node01
yum install ipvsadm -y
ipvsadm -A -t 192.168.118.100:80 -s rr
ipvsadm -a -t 192.168.118.100:80 -r 192.168.118.12 -g -w 1
ipvsadm -a -t 192.168.118.100:80 -r 192.168.118.13 -g -w 1
访问192.168.118.100可以看到node02和node03的httpd已经开始轮询
在node02和node03可以看到netstat -natp有大量访问记录
在node01中ipvsadm -lnc可以看到有大量访问记录(偷窥记录表)

 

Guess you like

Origin www.cnblogs.com/littlepage/p/11280176.html