一、LVS+Keepalived安装
1、下载源码包
cd /usr/src/
wget
wget
2、建立软链接
ln -s /usr/src/kernels/2.6.* /usr/src/linux
3、安装ipvsadm、keepalived
cd /usr/src/ && tar xzvf ipvsadm-1.24.tar.gz &&cd ipvsadm-1.24
&& make && make install
cd /usr/src/ && tar -xzvf keepalived-1.1.15.tar.gz &&
cd keepalived-1.1.15 && ./configure && make && make install
4、配置keepalived
cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
mkdir -p /etc/keepalived
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/sbin/keepalived /usr/sbin/
5、修改keepalived配置文件
vi /etc/keepalived/keepalived.conf,根据实际情况修改:
同理Lvs_backup也如上安装,并修改参数,Lvs+keepalived配置完毕后,启动keepalived, /etc/init.d/keepalived start 即可!然后在squid_1、squid_2分别执行realserver.sh脚本