赞助商

centos – UCARP:防止原来的主人在失败后回来时接管VIP?

发布时间:2019-05-15 发布网站:脚本之家
脚本之家收集整理的这篇文章主要介绍了centos – UCARP:防止原来的主人在失败后回来时接管VIP?脚本之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Keepalived可以通过在两个节点上组合nopreempt选项和BACKUP状态来完成此操作:

> Prevent VRRP Master from becoming Master once it has failed
> Prevent master to fall back to master after failure

UCARP怎么样?

Name       : ucarp
Arch       : x86_64
Version    : 1.5.2
Release    : 1.el5.rf
Size       : 81 k
Repo       : installed
Summary    : Common Address Redundancy Protocol (CARP) for Unix
URL        : http://www.ucarp.org/
License    : BSD
Description: UCARP allows a couple of hosts to share common virtual IP addresses in order
           : to provide automatic failover. It is a portable userland implementation of the
           : secure and patent-free Common Address Redundancy Protocol (CARP,OpenBSD's
           : alternative to the patents-bloated VRRP).
           : Strong points of the CARP protocol are: very low overhead,cryptographically
           : signed messages,interoperability between different operating systems and no
           : need for any dedicated extra network link between redundant hosts.

如果我不使用–preempt选项并将–advskew设置为相同的值,则两个节点都将成为主节点.

/etc/sysconfig/carp/vip-010.conf

# Virtual IP configuration file for UCARP
# The number (from 001 to 255) in the name of the file is the identifier
# $Id: vip-001.conf.example 1527 2004-07-09 15:23:54Z dude $

# Set the same password on all mamchines sharing the same virtual IP
PASSWORD="pa$$w0rd"

# You are required to have an IPADDR= line in the configuration file for
# this interface (so no DHCP allowed)
BIND_INTERFACE="eth0"

# Do *NOT* use a main interface for the virtual IP,use an ethX:Y alias
# with the corresponding /etc/sysconfig/network-scripts/ifcfg-ethX:Y file
# already configured and ith ONBOOT=no
VIP_INTERFACE="eth0:0"

# If you have extra options to add,see "ucarp --help" output
# (the lower the "-k <val>" the higher priority and "-P" to become master ASAP)
OPTIONS="-z -k 255"

的/ etc / SYSCONFIG /网络的脚本/的ifcfg-eth0的:0

DEVICE=eth0:0
ONBOOT=no
BOOTPROTO=
IPADDR=192.168.6.8
NETMASK=255.255.255.0
USERCTL=yes
IPV6INIT=no

节点1:

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether c6:9b:8e:af:a7:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.192/24 brd 192.168.6.255 scope global eth0
    inet 192.168.6.8/24 brd 192.168.6.255 scope global secondary eth0:0
    inet6 fe80::c49b:8eff:feaf:a769/64 scope link 
       valid_lft forever preferred_lft forever

节点2:

eth1: <BROADCAST,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:f7:0f:81 brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.38/24 brd 192.168.6.255 scope global eth1
    inet 192.168.6.8/24 brd 192.168.6.255 scope global secondary eth1:0
    inet6 fe80::230:48ff:fef7:f81/64 scope link 
       valid_lft forever preferred_lft forever

解决方法

对于UCARP,我认为诀窍是使用–neutral标志以“中性”模式启动它,这样它就不会自动承担主角色或在启动时尝试任何东西.查看我的一个设置,这是完整的命令行.或许 – 中性适用,因为我们在启动和关闭时应用了上下文,但值得一试.

/ path / to / ucarp0 -v 42 -p kitteh0 –interface = bond0 -a 192.168.100.250 -s 192.168.100.172 -b 5 -r 3 –upscript = / path / to / ucarp / upscript0 –downscript = / path / to / ucarp / downscript0 –neutral -z -B

总结

以上是脚本之家为你收集整理的centos – UCARP:防止原来的主人在失败后回来时接管VIP?全部内容,希望文章能够帮你解决centos – UCARP:防止原来的主人在失败后回来时接管VIP?所遇到的程序开发问题。

如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:76874919,请注明来意。
标签: