微信搜索superit|邀请体验:大数据, 数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

一步步教你lvs之教程一—安装Ipvsadm,keepalived

slb aide_941 12℃
首先架构计划的准备,两台lvs,两台nginx,两台web机:
# vip:10.235.165.100
# lvs-director:10.235.165.24 主lvs —lvs1(安装Ipvsadm,keepalived)
# lvs-director:10.235.165.12 备lvs —lvs2(安装Ipvsadm,keepalived)
# nginx1:10.235.165.26 安装nginx  —nginx1(安装nginx)
# nginx2:10.235.165.27 安装nginx  —nginx2(安装nginx)
# php/tomcat1:10.235.165.5 安装php,tomcat  —php1(这里省略)
# php/tomcat2:10.235.165.6 安装php,tomcat  —php2(这里省略)
安装:
ipvsadm_install,,
一步步教你lvs之教程一—安装Ipvsadm和keepalived
另存为然后直接运行就可以了,


# -------------------------------------------------------- #
## Ipvsadm_install
# -------------------------------------------------------- #
# ipvsadm installation
CURRENT_PATH=/vops
for i in $(rpm -q gcc gcc-c++ kernel-devel openssl-devel popt-devel popt-static libnl-devel |grep 'not installed' | awk '{print $2}')
do
yum -y install $i
done
[ -d ${CURRENT_PATH}/tools ]
[ "$?" != 0 ] && mkdir ${CURRENT_PATH}/tools
cd ${CURRENT_PATH}/tools
[ ! -e ipvsadm-1.26.tar.gz ] && wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
tar -zxvf ipvsadm-1.26.tar.gz
cd ipvsadm-1.26
make && make install
echo $? || [ $? != 0 ] || echo " installation ipvsadm failed" || exit 1
echo "modprobe ip_vs" >> /etc/rc.local
# ipvsadm start-up
[ -x ${CURRENT_PATH}/scripts/ipvsadm ] && [ "$?" != 0 ] && chmod 755 ${CURRENT_PATH}/scripts/ipvsadm
cp ${CURRENT_PATH}/scripts/ipvsadm /etc/init.d/
chkconfig --add ipvsadm
chkconfig --level 345 ipvsadm on
service ipvsadm start
# -------------------------------------------------------- #
## Keepalived_intsall
# -------------------------------------------------------- #
# Keepalived installation
cd ${CURRENT_PATH}/tools
[ ! -e keepalived-1.2.4.tar.gz ] && wget http://www.keepalived.org/software/keepalived-1.2.4.tar.gz
tar -zxvf keepalived-1.2.4.tar.gz
cd keepalived-1.2.4
ln -s /usr/src/kernels/$(uname -r) /usr/src/kernels/linux
./configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/bin --libexecdir=/usr/libexec --localstatedir=/var --libdir=/lib64 --infodir=/usr/share/info --sysconfdir=/etc --mandir=/usr/local/share/man --with-kernel-dir=/usr/src/kernels/linux
make && make install
echo $? || [ $? != 0 ] || print " installation keepalived failed" || exit 1
chkconfig --add keepalived
chkconfig --level 345 keepalived on

 

转载请注明:SuperIT » 一步步教你lvs之教程一—安装Ipvsadm,keepalived

喜欢 (0)or分享 (0)