LVS + piranha 之NAT配置
[
2008/09/14 11:02 | by askwan ]
2008/09/14 11:02 | by askwan ]
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. 测试
LVS + piranha 之Tunnel配置
[
2008/09/14 07:49 | by askwan ]
2008/09/14 07:49 | by askwan ]
OS : centos4.6
VIP : 192.168.18.200
LoadBalance: 192.168.18.241
BackUp: 192.168.18.242
Real Server1: 192.168.18.243
RealServer2: 192.168.18.244
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
5. 将配置文件copy至Backup相应目录下
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 0
修改为
net.ipv4.ip_forward = 1
#sysctl -p
7. 配置RealServer
创建IP Tunnel
将tunl0加入路由表(routing table)
#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
#echo 1 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
8. 启动RealServer上httpd服务
9. 启动LB和Backup上pulse
10. 测试
VIP : 192.168.18.200
LoadBalance: 192.168.18.241
BackUp: 192.168.18.242
Real Server1: 192.168.18.243
RealServer2: 192.168.18.244
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 = tunnel
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 = wrr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 192.168.18.243
active = 1
weight = 50
}
server node2 {
address = 192.168.18.244
active = 1
weight = 50
}
}
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 = tunnel
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 = wrr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 192.168.18.243
active = 1
weight = 50
}
server node2 {
address = 192.168.18.244
active = 1
weight = 50
}
}
5. 将配置文件copy至Backup相应目录下
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 0
修改为
net.ipv4.ip_forward = 1
#sysctl -p
7. 配置RealServer
创建IP Tunnel
Quotation
# ifconfig tunl0 192.168.18.240 netmask 255.255.255.255 broadcast 192.168.18.240 up
将tunl0加入路由表(routing table)
Quotation
# route add -host 192.168.18.240 dev tunl0
Quotation
#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
#echo 1 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
8. 启动RealServer上httpd服务
9. 启动LB和Backup上pulse
Quotation
#service pulse start
10. 测试
LVS + piranha 之DR配置
[
2008/09/14 07:45 | by askwan ]
2008/09/14 07:45 | by askwan ]
OS : centos4.6
VIP : 192.168.18.200
LoadBalance: 192.168.18.241
BackUp: 192.168.18.242
Real Server1: 192.168.18.243
RealServer2: 192.168.18.244
Gateway : 192.168.18.1
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
5. 将配置文件copy至Backup相应目录下
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
#sysctl -p
7. 配置RealServer
关闭ARP广播响应
8. 启动RealServer上httpd服务
9. 启动LB和Backup上pulse
10. 测试
VIP : 192.168.18.200
LoadBalance: 192.168.18.241
BackUp: 192.168.18.242
Real Server1: 192.168.18.243
RealServer2: 192.168.18.244
Gateway : 192.168.18.1
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 = 16
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 = direct
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 = wrr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 192.168.18.243
active = 1
weight = 50
}
server node2 {
address = 192.168.18.244
active = 1
weight = 50
}
}
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 = direct
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 = wrr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server node1 {
address = 192.168.18.243
active = 1
weight = 50
}
server node2 {
address = 192.168.18.244
active = 1
weight = 50
}
}
5. 将配置文件copy至Backup相应目录下
6. 分别在LB和BackUp上启用数据转发
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
#sysctl -p
7. 配置RealServer
Quotation
#ifconfig lo:0 192.168.18.240 broadcast 192.168.18.240 netmask 255.255.255.255 up
#route add -host 192.168.18.240 dev lo:0
#route add -host 192.168.18.240 dev lo:0
关闭ARP广播响应
Quotation
#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
#echo 1 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
#echo 1 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
8. 启动RealServer上httpd服务
9. 启动LB和Backup上pulse
Quotation
#service pulse start
10. 测试
httpd: apr_sockaddr_info_get() failed 错误
[
2008/09/11 09:50 | by askwan ]
2008/09/11 09:50 | by askwan ]
今天一客户机器出现这种错误
一般是由于系统hostname设置不当或者混乱造成的
解决方法:
确保系统hostname指令得出的值与 /etc/hosts 和 /etc/sysconfig/network所对应的值一致
这也提醒我们 修改系统的主机名 为了不必要的麻烦 就要同时修改这两个文件才行
再次启动httpd 就不会有这个错误了
至于下面这一行 设置apache配置文件 将ServerName 设置为对应IP地址即可
Quotation
[root@server ]/usr/local/apache2/bin/apachectl start
httpd: apr_sockaddr_info_get() failed for server
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd: apr_sockaddr_info_get() failed for server
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
一般是由于系统hostname设置不当或者混乱造成的
解决方法:
确保系统hostname指令得出的值与 /etc/hosts 和 /etc/sysconfig/network所对应的值一致
这也提醒我们 修改系统的主机名 为了不必要的麻烦 就要同时修改这两个文件才行
再次启动httpd 就不会有这个错误了
至于下面这一行 设置apache配置文件 将ServerName 设置为对应IP地址即可




