负载均衡集群LVS实战篇

Keepalived+LVS的高可用集群系统

一.拓扑图结构:

二.Keepalived的安装

1.主服务器的安装

[[email protected] ~]# wget http://www.keepalived.org/software/keepalived-1.2.20.tar.gz

[[email protected] ~]# tar -zxvf keepalived-1.2.20.tar.gz

[[email protected] ~]# cd keepalived-1.2.20/

[[email protected] keepalived-1.2.20]# ./configure --prefix=/usr/local/keepalived


configure: error:

!!! OpenSSL is not properly installed on your system. !!!

!!! Can not include OpenSSL headers files.            !!!

[[email protected] keepalived-1.2.20]# yum -y install openssl-devel libnl-devel libnfnetlink-devel ipvsadm

[[email protected] keepalived-1.2.20]# ./configure --prefix=/usr/local/keepalived


Keepalived configuration

------------------------

Keepalived version       : 1.2.20

Compiler                 : gcc

Compiler flags           : -g -O2 -DFALLBACK_LIBNL1

Extra Lib                : -lssl -lcrypto -lcrypt  -lnl

Use IPVS Framework       : Yes

IPVS sync daemon support : Yes

IPVS use libnl           : Yes

fwmark socket support    : Yes

Use VRRP Framework       : Yes

Use VRRP VMAC            : Yes

Use VRRP authentication  : Yes

SNMP keepalived support  : No

SNMP checker support     : No

SNMP RFCv2 support       : No

SNMP RFCv3 support       : No

SHA1 support             : No

Use Debug flags          : No

libnl version            : 1

Use IPv4 devconf         : No

Use libiptc              : No

Use libipset             : No

[[email protected] keepalived-1.2.20]# make && make install

[[email protected] keepalived-1.2.20]# ln -s /usr/local/keepalived/sbin/keepalived /usr/bin/keepalived

[[email protected] keepalived-1.2.20]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived

[[email protected] keepalived-1.2.20]# chmod 755 /etc/init.d/keepalived

[[email protected] keepalived-1.2.20]# chkconfig keepalived on

[[email protected] keepalived-1.2.20]# vim /etc/init.d/keepalived


# Source configuration file (we set KEEPALIVED_OPTIONS there)

. /etc/sysconfig/keepalived

改为:

# Source configuration file (we set KEEPALIVED_OPTIONS there)

. /usr/local/keepalived/etc/sysconfig/keepalived

[[email protected] keepalived-1.2.20]# mkdir /etc/keepalived

[[email protected] keepalived-1.2.20]# ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

[[email protected] keepalived-1.2.20]# service keepalived restart

2.主服务器配置文件

[[email protected] /]# vim /etc/keepalived/keepalived.conf


! Configuration File for keepalived

global_defs {

notification_email {

[email protected]

}

notification_email_from [email protected]

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id LVS_DEVEL

}

vrrp_instance VI_1 {

state MASTER

interface eno16777736

virtual_router_id 51

priority 100

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

virtual_ipaddress {

192.168.1.100

}

}

virtual_server 192.168.1.100 80 {

delay_loop 6

lb_algo rr

lb_kind DR

persistence_timeout 50

protocol TCP

real_server 192.168.1.30 80 {

weight 1

TCP_CHECK {

connect_port    80

connect_timeout 3

nb_get_retry 3

delay_before_retry 3

}

}

real_server 192.168.1.40 80 {

weight 1

TCP_CHECK {

connect_port    80

connect_timeout 3

nb_get_retry 3

delay_before_retry 3

}

}

}

3.配置 IPVS

3.1.开启IP转发功能

[[email protected] /]# echo 1 >/proc/sys/net/ipv4/ip_forward   默认是0,关闭ip转发;这里需要开启,所以设置值为1。

3.2.配置重定向

[[email protected] /]# echo "0" >/proc/sys/net/ipv4/ip_forward

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects

3.3.清除ipvsadm表

[[email protected] /]# ipvsadm –C

3.4.使用ipvsadm安装web服务

[[email protected] /]# ipvsadm -A -t 192.168.1.100:80-s rr

3.5.增加二台web服务器

[[email protected] /]# ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.30:80 -m -w 1

[[email protected] /]# ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.40:80 -m -w 1

3.6查看结果

[[email protected] ~]#  ipvsadm -L  -n


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.1.100:80 rr

-> 192.168.1.30:80              Route   1      0          1

-> 192.168.1.40:80              Route   1      0          0

[[email protected] keepalived-1.2.20]# service keepalived restart

4.主服务器IP查看

[[email protected] /]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:74:1f:4e brd ff:ff:ff:ff:ff:ff

inet 192.168.1.10/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet 192.168.1.100/32 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe74:1f4e/64 scope link

valid_lft forever preferred_lft forever

5.备服务器的安装

[[email protected] ~]# wget http://www.keepalived.org/software/keepalived-1.2.20.tar.gz

[[email protected] ~]# tar -zxvf keepalived-1.2.20.tar.gz

[[email protected] ~]# cd keepalived-1.2.20/

[[email protected] keepalived-1.2.20]# ./configure --prefix=/usr/local/keepalived


configure: error:

!!! OpenSSL is not properly installed on your system. !!!

!!! Can not include OpenSSL headers files.            !!!

[[email protected] keepalived-1.2.20]# yum -y install openssl-devel libnl-devel libnfnetlink-devel ipvsadm

[[email protected] keepalived-1.2.20]# ./configure --prefix=/usr/local/keepalived


Keepalived configuration

------------------------

Keepalived version       : 1.2.20

Compiler                 : gcc

Compiler flags           : -g -O2 -DFALLBACK_LIBNL1

Extra Lib                : -lssl -lcrypto -lcrypt  -lnl

Use IPVS Framework       : Yes

IPVS sync daemon support : Yes

IPVS use libnl           : Yes

fwmark socket support    : Yes

Use VRRP Framework       : Yes

Use VRRP VMAC            : Yes

Use VRRP authentication  : Yes

SNMP keepalived support  : No

SNMP checker support     : No

SNMP RFCv2 support       : No

SNMP RFCv3 support       : No

SHA1 support             : No

Use Debug flags          : No

libnl version            : 1

Use IPv4 devconf         : No

Use libiptc              : No

Use libipset             : No

[[email protected] keepalived-1.2.20]# make && make install

[[email protected] keepalived-1.2.20]# ln -s /usr/local/keepalived/sbin/keepalived /usr/bin/keepalived

[[email protected] keepalived-1.2.20]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived

[[email protected] keepalived-1.2.20]# chmod 755 /etc/init.d/keepalived

[[email protected] keepalived-1.2.20]# chkconfig keepalived on

[[email protected] keepalived-1.2.20]# vim /etc/init.d/keepalived

[[email protected] keepalived-1.2.20]# mkdir /etc/keepalived

[[email protected] keepalived-1.2.20]# ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

[[email protected] keepalived-1.2.20]# service keepalived restart

6.备服务器配置文件

[[email protected] /]# vim /etc/keepalived/keepalived.conf


! Configuration File for keepalived

global_defs {

notification_email {

[email protected]

}

notification_email_from [email protected]

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id LVS_DEVEL

}

vrrp_instance VI_1 {

state BACKUP

interface eno16777736

virtual_router_id 51

priority 99

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

virtual_ipaddress {

192.168.1.100

}

}

virtual_server 192.168.1.100 80 {

delay_loop 6

lb_algo rr

lb_kind DR

persistence_timeout 50

protocol TCP

real_server 192.168.1.30 80 {

weight 1

TCP_CHECK {

connect_port    80

connect_timeout 3

nb_get_retry 3

delay_before_retry 3

}

}

real_server 192.168.1.40 80 {

weight 1

TCP_CHECK {

connect_port    80

connect_timeout 3

nb_get_retry 3

delay_before_retry 3

}

}

}

7.配置 IPVS

7.1.开启IP转发功能

[[email protected] /]# echo 1 >/proc/sys/net/ipv4/ip_forward

7.2.配置重定向

[[email protected] /]# echo "0" >/proc/sys/net/ipv4/ip_forward

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects

[[email protected] /]# echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects

7.3.清除ipvsadm表

[[email protected] /]# ipvsadm –C

7.4.使用ipvsadm安装web服务

[[email protected] /]# ipvsadm -A -t 192.168.1.100:80-s rr

7.5.增加二台web服务器

[[email protected] /]# ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.30:80 -m -w 1

[[email protected] /]# ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.40:80 -m -w 1

7.6查看结果

[[email protected] /]#  ipvsadm -L  -n


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.1.100:80 rr

-> 192.168.1.30:80              Route   1      0          1

-> 192.168.1.40:80              Route   1      0          0

[[email protected] /]# service keepalived restart

8.备服务器IP查看

[[email protected] /]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:85:b8:f8 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.20/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe85:b8f8/64 scope link

valid_lft forever preferred_lft forever

备注:如果主备服务器都有VIP存在,请关闭selinux和防火墙

# setenforce 0

# systemctl stop firewalld.service

三.web服务器的配置

1.此处以默认安装好的web服务,如Nginx和Apache等等。只进行节点的配置步骤。简单安装apache服务,方便后面的测试。

[[email protected] /]# yum -y install httpd

[[email protected] /]# vim /var/www/html/index.html

<h1>web1 server</h1>

[[email protected] /]# systemctl start httpd.service

[[email protected] /]# yum -y install httpd

[[email protected] /]# vim /var/www/html/index.html

<h1>web2 server</h1>

[[email protected] /]# systemctl start httpd.service

2.web1服务器LVS配置:

[[email protected] /]# vim /etc/init.d/lvsrs


#!/bin/bash

#description:start realserver

vip=192.168.1.100

source /etc/rc.d/init.d/functions

case $1 in

start)

echo "Start Realserver"

/sbin/ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 up

echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce

echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce

;;

stop)

echo "Stop Realserver"

/sbin/ifconfig lo:0 down

echo "0" > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo "0" > /proc/sys/net/ipv4/conf/lo/arp_announce

echo "0" > /proc/sys/net/ipv4/conf/all/arp_ignore

echo "0" > /proc/sys/net/ipv4/conf/all/arp_announce

;;

*)

echo "Usage: $0 (start | stop)"

exit 1

esac

[[email protected] /]# chmod 755 /etc/init.d/lvsrs

[[email protected] /]# service lvsrs start

3.web2服务器LVS配置:

[[email protected] ~]# vim /etc/init.d/lvsrs


#!/bin/bash

#description:start realserver

vip=192.168.1.100

source /etc/rc.d/init.d/functions

case $1 in

start)

echo "Start Realserver"

/sbin/ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 up

echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce

echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce

;;

stop)

echo "Stop Realserver"

/sbin/ifconfig lo:0 down

echo "0" > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo "0" > /proc/sys/net/ipv4/conf/lo/arp_announce

echo "0" > /proc/sys/net/ipv4/conf/all/arp_ignore

echo "0" > /proc/sys/net/ipv4/conf/all/arp_announce

;;

*)

echo "Usage: $0 (start | stop)"

exit 1

esac

[[email protected] ~]# chmod 755 /etc/init.d/lvsrs

[[email protected] ~]# service lvsrs start

到此为止,Keepalived+LVS的高可用集群系统搭建完成,下面进行测试。

四.高可用keepalived功能测试

1.先停掉主服务器上的keepalived服务,看看备服务器是否接管vip

[[email protected] ~]# service keepalived stop

[[email protected] ~]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:74:1f:4e brd ff:ff:ff:ff:ff:ff

inet 192.168.1.10/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe74:1f4e/64 scope link

valid_lft forever preferred_lft forever

2.查看备服务器的ip

[[email protected] ~]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:85:b8:f8 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.20/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet 192.168.1.100/32 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe85:b8f8/64 scope link

valid_lft forever preferred_lft forever

上面信息可以看到备服务器已经接管vip地址。

3.恢复主服务器keepalived服务。

[[email protected] ~]# service keepalived start

[[email protected] ~]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:74:1f:4e brd ff:ff:ff:ff:ff:ff

inet 192.168.1.10/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet 192.168.1.100/32 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe74:1f4e/64 scope link

valid_lft forever preferred_lft forever

上面信息可以看到主服务器已经重新接管vip地址。

4.再查看备服务器ip地址

[[email protected] ~]# ip add


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 00:0c:29:85:b8:f8 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.20/24 brd 192.168.1.255 scope global eno16777736

valid_lft forever preferred_lft forever

inet6 fe80::20c:29ff:fe85:b8f8/64 scope link

valid_lft forever preferred_lft forever

上面信息可以看到主服务器已经释放了vip地址。

五.负载均衡LVS功能测试

打开浏览器输入http://192.168.1.100.不断刷新页面分别看到web1 server和web2 server表示LVS已经负载均衡了。

六.故障切换测试

1.停掉web1服务器的httpd服务

[[email protected] ~]# systemctl stop httpd.service

2. 查看主服务器状态

[[email protected] ~]# ipvsadm


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  wjb10000-master:http rr

-> 192.168.1.40:http            Route   1      0          0

3.查看备服务器状态

[[email protected] ~]# ipvsadm


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.1.100:http rr

-> 192.168.1.40:http            Route   1      0          0

以上内容可以看出Keepalived检测web1服务器出现故障,将此服务器从集群中移除。

4.恢复web1服务器

[[email protected] ~]# systemctl start httpd.service

5.再查看主服务器状态

[[email protected] ~]# ipvsadm


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  wjb10000-master:http rr

-> 192.168.1.30:http            Route   1      0          0

-> 192.168.1.40:http            Route   1      0          0

6.再查看备服务器状态

[[email protected] ~]# ipvsadm


IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.1.100:http rr

-> 192.168.1.30:http            Route   1      0          0

-> 192.168.1.40:http            Route   1      0          0

节点恢复重新加入集群当中,浏览器刷新页面,可以重新看到web1 server和web2 server内容交替显示。

结束语:到此Keepalived+LVS的高可用集群系统实验完全结束。大家哪里不明白的欢迎留言。

时间: 2024-11-06 23:02:32

负载均衡集群LVS实战篇的相关文章

负载均衡集群LVS基础篇

一. LVS简介 LVS是Linux Virtual Server的简称,也就是Linux虚拟服务器, 是一个由章文嵩博士发起的自由软件项目,它的官方站点是www.linuxvirtualserver.org.现在LVS已经是 Linux标准内核的一部分,在Linux2.4内核以前,使用LVS时必须要重新编译内核以支持LVS功能模块,但是从Linux2.4内核以后,已经完全内置了LVS的各个功能模块,无需给内核打任何补丁,可以直接使用LVS提供的各种功能.        使用LVS技术要达到的目

负载均衡集群LVS安装篇

一.检查内核是否支持LVS [[email protected] /]# uname -a Linux wjb10000 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux 备注:2.4.23以后版本的内核已经支持LVS,只需要直接使用,不需要进行内核的下载和更新工作. 二.检查内核是否支持lvs的ipvs模块 [[email protected] ~]# modprobe

负载均衡集群HAProxy基础篇

负载均衡集群HAProxy基础篇 一.   HAPorxy简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件,HAProxy是完全免费的.借助HAProxy可以快速并且可靠的提供基于TCP和HTTP应用的代理解决方案. 二.   HAPorxy优点 免费开源.可靠性和稳定性非常好. HAProxy可以处理数据可达10Gbps-New benchmark of HAProxy at 10 Gbps using Myricom's 10GbE

linux下负载均衡集群 LVS之NAT类型

1.集群类型分下3种: LB: Load Balancing,负载均衡 HA:High Availability, 高可用 HP:High Performance, 高性能 2.LB负载均衡四层LVS类型分为以下3种:(Linux Virtual Server) NAT:地址转换 DR: 直接路由 TUN:隧道 2.1.NAT: 集群节点跟director必须在同一个IP网络中: RIP通常是私有地址,仅用于各集群节点间的通信: director位于client和real server之间,并负

负载均衡集群HAProxy安装篇

负载均衡集群HAProxy安装篇 一.HAProxy的yum安装 [[email protected] ~]# yum -y install haproxy//安装 [[email protected] ~]# systemctl start haproxy.service//启动服务 [[email protected] ~]# systemctl status haproxy.service//查看服务 [[email protected] ~]# systemctl enable hapr

负载均衡--集群 &nbsp; LVS+keepalived

常用的负载均衡开源软件有: nginx.lvs.keepalived 商业的硬件负载设备: F5.Netscale 1. LB.LVS介绍LB集群是load balance 集群的简写,翻译成中文就是负载均衡集群http://www.aminglinux.com/bbs/data/attachment/forum/201406/16/115112w1we1x4e5ueewzrd.png LVS是一个实现负载均衡集群的开源软件项目 LVS架构从逻辑上可分为调度层(Director).server集

LB负载均衡集群--LVS

LB集群: LB集群是load balance 集群的简写,翻译成中文就是负载均衡集群.常用的负载均衡开源软件有nginx.lvs.keepalived ,商业的硬件负载设备F5.Netscale. LB集群架构: 当用户的请求过来时,会直接发到分发器(Director Server)上,然后它把用户的请求根据预先设置好的算法,智能均衡地分发到后端的真正服务器(real server)上.如果不同的机器,可能用户请求到的数据不一样,为了避免这样的情况发生,所以用到了共享存储,这样保证所有用户请求

用 LVS 搭建一个负载均衡集群(转)

http://blog.jobbole.com/87503/ 第一篇:<如何生成每秒百万级别的 HTTP 请求?> 第二篇:<为最佳性能调优 Nginx> 第三篇:<用 LVS 搭建一个负载均衡集群> 这篇文章是<打造3百万次请求/秒的高性能服务器集群>系列的第3部分,有关于性能测试工具以及优化WEB服务器部分的内容请参看以前的文章. 本文基于你已经优化好服务器以及网络协议栈的基础之上,并使用 iperf 与 netperf 工具测试将服务器已优化到支持 5

LVS搭建负载均衡集群

1.集群的概念: 服务器集群就是将很多服务器集中起来一起进行同一种服务,在客户端看来就像是只有一个服务器 2.集群的分类: 高可用集群(HA) 主要用于高可用解决方案的实现,节点间以主备形式,实现容灾:在大型故障的情况下实现快速恢复,快速提供服务 工作方式: 主从方式:主机工作,备机监控 互为主从:两服务器同时在线,一台服务器故障可切换到另一台上.有效的利用服务器资源,但当服务器故障时候,将可能导致服务器负载过大 多台服务器主从:大部分服务器在线使用,小部分监控:若有部分服务器故障,可切换到指定