欢迎来到天天文库
浏览记录
ID:40568596
大小:56.50 KB
页数:3页
时间:2019-08-04
《lvs+keepalived+DR安装》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一,Lvs客户端(ubuntu脚本)1,[root@huludao-2~]#vi/usr/local/bin/lvs_real#!/bin/bash#description:startrealserverVIP=192.168.6.134case"$1"instart)echo"startLVSofREALServer"/sbin/ifconfiglo:0$VIPbroadcast$VIPnetmask255.255.255.255upecho"1">/proc/sys/net/ipv4/conf/lo/arp_ignoreech
2、o"2">/proc/sys/net/ipv4/conf/lo/arp_announceecho"1">/proc/sys/net/ipv4/conf/all/arp_ignoreecho"2">/proc/sys/net/ipv4/conf/all/arp_announce;;stop)/sbin/ifconfiglo:0downecho"closeLVSDirectorserver"echo"0">/proc/sys/net/ipv4/conf/lo/arp_ignoreecho"0">/proc/sys/net/ipv4/c
3、onf/lo/arp_announceecho"0">/proc/sys/net/ipv4/conf/all/arp_ignoreecho"0">/proc/sys/net/ipv4/conf/all/arp_announce;;*)echo"Usage:$0{start
4、stop}"exit1esac配置脚本写好保存,给予脚本执行权限。脚本启停以/usr/local/bin/lvs_realstart
5、stop来启动。通过来ipadd检查网络状态。从输出可以看出,lo:0确实绑定了我们指定的vip地址。那么当我们执行/usr/l
6、ocal/bin/lvs_real时,vip应当从lo:0接口卸载。2,打开二,LvsLD(centos5.3)1,Ipvsadmin默认已安装(安装系统时候,勾上cluster)2,keepalived的安装#tar-zxvfkeepalived-1.1.19.tar.gz#cdkeepalived-1.1.19./configure--prefix=/usr/local/keepalived--with-kernel-dir=/usr/src/kernels/2.6.18-128.el5PAE-i686/(注意编译时一定要支持
7、IPVS)#make;makeinstall#cp/usr/local/keepalived/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/#cp/usr/local/keepalived/etc/sysconfig/keepalived/etc/sysconfig/#mkdir/etc/keepalived#cp/usr/local/keepalived/etc/keepalived/keepalived.conf/etc/keepalived/#cp/usr/local/keepaliv
8、ed/sbin/keepalived/usr/sbin/#servicekeepalivedstart
9、stop
10、status#chkconfig--addkeepalived#chkconfig--level345keepalivedon3,在/etc/sysconfig/network-scripts下新建一个vilo:0DEVICE=lo:0IPADDR=192.168.6.134NETMASK=255.255.255.255NETWORK=192.168.6.0#Ifyou'rehavingproblemswithgate
11、dmaking127.0.0.0/8amartian,#youcanchangethistosomethingelse(255.255.255.255,forexample)BROADCAST=192.168.6.134ONBOOT=yesNAME=loopback启动lo:0ifuplo:0(重启机器后一定要记得执行)4,keepalived.conf的编辑vi/etc/keepalived/keepalived.conf!ConfigurationFileforkeepalivedglobal_defs{notificatio
12、n_email{sysadmin@firewall.loc}notification_email_fromAlexandre.Cassen@firewall.locsmtp_server127.0.0.1smtp_connect_timeout30
此文档下载收益归作者所有