Centos7 搭建 Keepalived+LVS 备注

Posted guangfengli

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 搭建 Keepalived+LVS 备注相关的知识,希望对你有一定的参考价值。

NAT模型需要RealServer gateway设定为,DR模式需要执行 RealServer.sh。需要先安装network-tools.

#!/bin/bash
#description : start realserver
VIP=192.168.8.188
host=‘/bin/hostname‘
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo down
/sbin/ifconfig lo up
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
/sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
;;
stop)
/sbin/ifconfig lo:0 down
;;
status)
islothere=‘/sbin/ifconfig lo:0 | grep $VIP‘
isrothere=‘netstat -rn | grep "lo" | grep $VIP‘
if[! "$islothere" -o ! "$isrothere"];then
echo "LVS-DR real server stoped"
else
echo "LVS-DR Running"
fi
;;
*)
echo "$0: Usage: $0 {start|status|stop}"
exit 1
;;
esac

 

以上是关于Centos7 搭建 Keepalived+LVS 备注的主要内容,如果未能解决你的问题,请参考以下文章

Centos7 搭建 Keepalived+LVS 备注

centos7.2 搭建keepalived+lvs

linux 负载均衡配置 keepalive lvs 使用nginx转发 CentOS7 搭建LVS+keepalived负载均衡

Centos7搭建lvs+keepalive负载均衡集群

搭建:LVS+Keepalived高可用Web服务群集环境

CentOS7.4—构建LVS+Keepalived高可用群集