说明:
一、目 的:本文实现的Linux集群是基于Keepalived-1.2.7软件实现,
二、难 点:实现虚拟IP(VIP)自动切换的同时,还要同时实现虚拟MAC地址(VMAC)的切换,即无论集群中的Host如何切换,对外访问的IP和MAC始终不变
三、适用环境:当对外路由或交换机绑定主机MAC时适用
四、说 明:若无须对外绑定MAC地址,则大可简化如下配置
1. 环境及软件:
1) 系统:Debian6 x32
2) 内核:linux 3.2.0-0.bpo.3-686-pae
3) 软件:keepalived-1.2.7
2. 配置:
MASTER设备IP: eth0: 10.10.1.200/24 eth1:192.168.61.253/21
BACKUP设备IP: eth0: 10.10.1.100/24 eth1:192.168.61.252/21
VIP: 192.168.61.248/21
3. 安装步骤:
1)升级当前Debian系统内核linux 2.6.32
a) 修改Debian源文件,添加一个向后兼容的源
deb http://ftp.cn.debian.org/debian-backports squeeze-backports main
# nano /etc/apt/sources.list
b) 更新Debian源文件关联并升级系统内核至3.2.0
# aptitude update
# aptitude -t squeeze-backports install linux-image-3.2.0-0.bpo.3-686-pae
如果编译NVDIA的官方驱动的话,还要装:
# aptitude -t squeeze-backports install linux-headers-3.2.0.bpo.3-686-pae
2) 安装keepalived-1.2.7