浏览 3591 次
锁定老帖子 主题:Linux keepalived配置
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-04-04
最后修改:2010-04-10
rpm -ivh ipvsadm-1.24-8.1.x86_64.rpm 1.2.检查ipvsadm是否被正确安装: [root@proxy1 ~]# ipvsadm IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn 1.3.查看是否存在ip_vs模块: [root@proxy1 ~]# lsmod | grep ip_vs ip_vs 121217 0 2.1 安装keepalived 下载地址:http://www.keepalived.org/download.htm 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/ 2.2 configure成功后的显示为: 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 2.3 编译,安装 make make install 3.1 编辑keepalved.conf配置文件(主服务器) 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 } } 3.2 编辑keepalved.conf配置文件(备份服务器) 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 } } 4.1 将keepalived服务加入开机启动启动。 chkconfig --add keepalived chkconfig --level 35 keepalived on 4.2 启动keepalived keepalived 查看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 发现VIP 10.238.15.103地址,证明MASTER一起启动浮动IP [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 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |