Install with Yum (check if Yum is available and install with Yum if available)
#yum Install Ipvsadm Piranha
Modifying the LVS Configuration
#cd/etc/sysconfig/ha/
Back up the LVS default profile before creating a new configuration file
#mv lvs.cf Lvs.cf.back
#vi LVS.CF # # # #内容如下
Serial_no = 39
Primary = 10.5.20.12
Service = LVs
Backup_active = 1
Backup = 10.5.20.13
Heartbeat = 1
Heartbeat_port = 539
KeepAlive = 3
Deadtime = 9
Network = Direct
Debug_level = NONE
Monitor_links = 0
Syncdaemon = 0
Virtual XP {
Active = 1
Address = 10.5.20.14 bond0: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 = WLC
protocol = TCP
Timeout = 5
reentry = 5
Quiesce_server = 0
Server XP1 {
Address = 10.5.20.12
Active = 1
Weight = 1
}
Server XP2 {
Address = 10.5.20.13
Active = 1
Weight = 1
}
}
The
Starts the heartbeat service on two physical machines separately:
# service Pulse start
starting Pulse: [ ok ]
at this time, can be seen on the main physical machine 10.5.20.12 load Balancer network card has been started,
and 10.5.20.13 is not on this network card:
# ifconfig
Bond0 Link encap:ethernet HWaddr 00:0c:29:e9:2f:f0
inet addr:10.5.20.12 bcast:10.5.23.255 mask:255.255.252.0
Inet6 ADDR:FE80::20C:29FF:FEE9:2FF0/64 Scope:link
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
RX packets:2039549 errors:0 dropped:0 overruns:0 frame:0
TX packets:692572 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:748901428 (714.2 MiB) TX bytes:153254084 (146.1 MiB)
bond0:0 Link encap:ethernet HWaddr 00:0c:29:e9:2f:f0
inet addr:10.5.20.14 bcast:10.5.20.255 mask:255.255.255.0
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
When the service of the primary physical machine shuts down, you see that the NIC is started on 10.5.20.13:
# ifconfig
Bond0 Link encap:ethernet HWaddr 00:0c:29:4c:fc:a4
inet addr:10.5.20.13 bcast:10.5.23.255 mask:255.255.252.0
Inet6 ADDR:FE80::20C:29FF:FE4C:FCA4/64 Scope:link
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
RX packets:19679 errors:0 dropped:0 overruns:0 frame:0
TX packets:16633 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18527316 (17.6 MiB) TX bytes:1528599 (1.4 MiB)
bond0:0 Link encap:ethernet HWaddr 00:0c:29:4c:fc:a4
inet addr:10.5.20.14 bcast:10.5.20.255 mask:255.255.255.0
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
To view virtual Server status:
# IPVSADM-LN
IP Virtual Server version 1.2.1 (size=4096)
Prot Localaddress:port Scheduler Flags
Remoteaddress:port Forward Weight activeconn inactconn
TCP 10.5.20.14:80 WLC
Set the service to boot from:
# chkconfig--level 345 Pulse on
This article is from the "Stone" blog, be sure to keep this source http://410477.blog.51cto.com/400477/1639030
LVS cluster configuration