OS : centos4.6
VIP : 192.168.18.240
LoadBalance: eth0: 192.168.18.241
eth1: 10.10.10.241
BackUp: eth0: 192.168.18.242
eth1: 10.10.10.242
Real Server1: 10.10.10.243
RealServer2: 10.10.10.244
Gateway : 10.10.10.241(10.10.10.242)
1. 安装piranha和ipvsadm
2. 设置piranha密码
piranha-passwd
3. 启动piranha-gui
service piranha-gui start
4. 配置LVS
http://192.168.18.241:3636
具体配置过程不详述
附上配置文件
vim /etc/sysconfig/ha/lvs.cf
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
#sysctl -p
7. 启动RealServer上httpd服务
8. 启动LB和Backup上pulse
9. 测试
VIP : 192.168.18.240
LoadBalance: eth0: 192.168.18.241
eth1: 10.10.10.241
BackUp: eth0: 192.168.18.242
eth1: 10.10.10.242
Real Server1: 10.10.10.243
RealServer2: 10.10.10.244
Gateway : 10.10.10.241(10.10.10.242)
1. 安装piranha和ipvsadm
2. 设置piranha密码
piranha-passwd
3. 启动piranha-gui
service piranha-gui start
4. 配置LVS
http://192.168.18.241:3636
具体配置过程不详述
附上配置文件
vim /etc/sysconfig/ha/lvs.cf
serial_no = 14
primary = 192.168.18.241
service = lvs
backup_active = 1
backup = 192.168.18.242
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = nat
nat_router = 10.10.10.241 eth1
nat_nmask = 255.255.255.0
debug_level = NONE
monitor_links = 0
virtual webserv {
active = 1
address = 192.168.18.240 eth0:1
vip_nmask = 255.255.255.0
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 10.10.10.243
active = 1
weight = 50
}
server node2 {
address = 10.10.10.244
active = 1
weight = 50
}
}
5. 将配置文件copy至Backup相应目录下primary = 192.168.18.241
service = lvs
backup_active = 1
backup = 192.168.18.242
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = nat
nat_router = 10.10.10.241 eth1
nat_nmask = 255.255.255.0
debug_level = NONE
monitor_links = 0
virtual webserv {
active = 1
address = 192.168.18.240 eth0:1
vip_nmask = 255.255.255.0
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 10.10.10.243
active = 1
weight = 50
}
server node2 {
address = 10.10.10.244
active = 1
weight = 50
}
}
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
#sysctl -p
7. 启动RealServer上httpd服务
8. 启动LB和Backup上pulse
Quotation
#service pulse start
9. 测试
作者:askwan@『AskWan』
地址:http://www.askwan.com/post/106/
可以转载,转载时请以链接形式注明作者和原始出处及本声明!
LVS + piranha 之Tunnel配置
LVS + Keepalived 之DR实现

2008/09/14 11:02 | by











