日期:2014-05-16 浏览次数:21017 次
rpm -ivh ipvsadm-1.24-8.1.x86_64.rpm
[root@proxy1 ~]# ipvsadm IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn
[root@proxy1 ~]# lsmod | grep ip_vs ip_vs 121217 0
tar -zxvf keepalived-1.1.18.tar.gz cd keepalived-1.1.18 ./configure --prefix=/usr --sysconf=/etc --with-kernel-dir=/usr/src/kernels/2.6.18-128.el5-x86_64/
Keepalived configuration Keepalived version : 1.1.15 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto Use IPVS Framework : Yes IPVS sync daemon support : Yes Use VRRP Framework : Yes Use LinkWatch : No Use Debug flags : No
make make install
vi /etc/keepalived/keepalived.conf
global_defs {
router_id NGBOSSLVS_NODE_1
}
vrrp_instance V_NGBOSS {
state MASTER
interface eth0
lvs_sync_daemon_inteface eth0
virtual_router_id 51
priority 200
advert_int 2
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.238.15.103
}
}
vi /etc/keepalived/keepalived.conf
global_defs {
router_id NGBOSSLVS_NODE_2
}
vrrp_instance V_NGBOSS {
state BACKUP
interface eth0
lvs_sync_daemon_inteface eth0
virtual_router_id 51
priority 100
advert_int 2
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.238.15.103
}
}
chkconfig --add keepalived chkconfig --level 35 keepalived on
keepalived
[root@proxy1 keepalived]# ps -ef | grep keepalived root 4003 1 0 Apr01 ? 00:00:00 keepalived -D root 4004 4003 0 Apr01 ? 00:05:32 keepalived -D root 4019 4003 0 Apr01 ? 00:05:39 keepalived -D
[root@proxy1 keepalived]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:23:7d:d1:be:0e brd ff:ff:ff:ff:ff:ff
inet 10.238.15.101/24 brd 10.238.15.255 scope global eth0
inet 10.238.15.103/32 scope global eth0
inet6 fe80::223:7dff:fed1:be0e/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 00:23:7d:d1:be:10 brd ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
5: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff