piranha + lvs图形化配置
调度主机:192.168.0.85;192.168.0.52realserver:192.168.0.96;192.168.0.66
realserver:
# ifconfig lo:0 192.168.0.136 netmask 255.255.255.255 up
#route add -host 192.168.0.136 dev lo:0
# yum install -y httpd
# vim /var/www/html/index.html
# /etc/init.d/httpd start
192.168.0.85配置:
# yum install -y piranha
# rpm -q ipvsadm
ipvsadm-1.25-9.el6.x86_64
# /etc/init.d/piranha-gui start
Starting piranha-gui:
# netstat -antlp
tcp 0 0 :::3636 :::* LISTEN 1345/httpd
# piranha-passwd
New Password:
Verify:
Adding password for user piranha
现在浏览器访问192.168.0.85:3636
username:piranha
passwd:刚才设置的
添加一个物理网卡:
# cp ifcfg-eth0 ifcfg-eth1
根据 /etc/udev/rules.d/70-persistent-net.rules 文件中的提示修改ifcfg-eth1,该网卡用于心跳检测的!
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="none"
HWADDR="52:54:00:8d:82:cc"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=10.0.0.85
NETMASK=255.255.255.0
通过浏览器配置配置文件:
GLOBAL SETTINGS =>
Primary server public IP:192.168.0.85
Primary server private IP:10.0.0.85
=>ACCEPT,此时,就已经在/etc/sysconfig/ha/lvs.cf写入配置
REDUNDANCY=>
Redundant server public IP:192.168.0.52
Redundant server private IP:10.0.0.52
勾选Monitor NIC links for failures和Syncdaemon
=>ACEPT
根据服务配置一下VIRTUAL SERVERS
浏览器页面=>VIRTUAL SERVERS=>(DE)ACTIVATE
浏览器页面=>VIRTUAL SERVERS=>(DE)ACTIVATE=>EDIT=>REAL SERVER=选中主机并激活
# /etc/init.d/pulse start
Starting pulse:
# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCPserver36.example.com:http rr
-> desktop66.example.com:http Route 1 0 0
-> desktop96.example.com:http Route 1 0 0
此时在192.168.0.52上也安装pinanha 和配置虚拟心跳IP
# scp lvs.cf 192.168.0.52:/etc/sysconfig/ha/
ot@desktop52 ha]# cat lvs.cf
serial_no = 16
primary = 192.168.0.85
primary_private = 10.0.0.85
service = lvs
backup_active = 1
backup = 192.168.0.52
backup_private = 10.0.0.52
heartbeat = 1
heartbeat_port = 1045
keepalive = 3
deadtime = 5
network = direct
debug_level = NONE
monitor_links = 1
syncdaemon = 1
virtual web {
active = 1
address = 192.168.0.136 eth0:0
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 = rr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server desktop96.example.com {
address = 192.168.0.96
active = 1
port = 80
weight = 1
}
server desktop66.example.com {
address = 192.168.0.66
active = 1
port = 80
weight = 1
}
}
页:
[1]