真的是搞了很久 结果一问人才知道真的是neutron的问题

当然前提是设置unicast 而不是默认设置

先贴出来后面再更新图片

[root@haproxy1 ~]# cat /etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 200
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 10.0.0.121
unicast_peer {
10.0.0.122
}

==== haproxy2

[root@haproxy2 ~]# cat /etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state SLAVE
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 10.0.0.122
unicast_peer {
10.0.0.121
}
virtual_ipaddress {
10.0.0.200/24 brd 10.0.0.255 dev eth0 label eth0:vip
}
}
[root@haproxy2 ~]#

测试arp

# tcpdump -i eth0 vrrp -n
可以显示VIP 但是就是无法ping通vip 10.0.0.200

问题出在openstack中的

ALLOWED-ADDRESS-PAIRS

https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/10/html/networking_guide/sec-allowed-address-pairs

Allowed-address-pairs allow you to specify mac_address/ip_address (CIDR) pairs that pass through a port regardless of subnet. This enables the use of protocols such as VRRP, which floats an IP address between two instances to enable fast data plane failover.

  

haproxy1
| 59f73969--4e87-b829-9ece9d905541 | | fa::3e:d8::a2 | {"subnet_id": "36350ca0-2734-44ca-9167-7713ff9925e2", "ip_address": "10.0.0.121"} haproxy2
| 7b49f386-e908-42ac-89ef-dc9d977b37e5 | | fa::3e:4e::8b | {"subnet_id": "36350ca0-2734-44ca-9167-7713ff9925e2", "ip_address": "10.0.0.122"}
set vip = ubuntu@p01-neutron-a1-e1c7g7:~$ neutron port-update 7b49f386-e908-42ac-89ef-dc9d977b37e5 --allowed-address-pairs type=dict list=true ip_address=10.0.0.200
Updated port: 7b49f386-e908-42ac-89ef-dc9d977b37e5
ubuntu@p01-neutron-a1-e1c7g7:~$

然后就好了。。还真是无语

=== 更新 不停failover 问题

[root@haproxy1 ~]# cat /etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state BACKUP #全部设置成backup 通过priority的数字去竞争谁是master那么就不会在master起来后 vip跳到原来master上面去了
interface eth0
virtual_router_id 51
priority 50 #has issue so aleays make it secondary
advert_int 1
nopreempt # 防止变成master后 vip会failback
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 10.0.0.121
unicast_peer {
10.0.0.122
}
virtual_ipaddress {
10.0.0.200/24 brd 10.0.0.255 dev eth0 label eth0:vip
}
}

  

参考

https://blog.51cto.com/13590999/2096701

nopreempt        #设置为不抢占 注:这个配置只能设置在backup主机上,而且这个主机优先级要比另外一台高

但是!!!!master不能设置nopreempt

所以解决方案是:不设置master,全部设置成backup,这样大家都是backup,就都能添加nopreempt,即使原本成为master的LB坏掉重新修好之后也不会抢占master。

通常如果master服务死掉后backup会变成master,但是当master服务又好了的时候 master此时会抢占VIP,这样就会发生两次切换对业务繁忙的网站来说是不好的。所以我们要在配置文件加入 nopreempt 非抢占,但是这个参数只能用于state 为backup,故我们在用HA的时候最好master 和backup的state都设置成backup 让其通过priority来竞争

openstack环境下搭建的keepalived 两台服务器直接无法ping通VIP ALLOWED-ADDRESS-PAIRS的更多相关文章

  1. openstack环境下的虚拟机通过浮动IP访问后能ping通外网IP不能ping通域名

    1.环境简介 openstack环境下构造Ubuntu系统的VM,VM配置受管子网和自管子网,同时绑定浮动IP 2.通过浮动IP访问VM后,ping www.baidu.com失败,但是通过IP地址p ...

  2. 问题解决:两台虚拟机不能互相ping通的原因

    要是两台虚拟机能够PING通下列要求缺一不可:1.你所设置的虚拟网络的网络号不能跟外面你正在使用的真实的网络号一样2.防火墙必须关闭3.你设置的那俩台虚拟机必须在同一网段内4.两台虚拟机的主机名不能相 ...

  3. CentOS6.8环境下搭建yum网络仓库

    CentOS6.8环境下搭建yum网络仓库 本文利用ftp服务,在CentOS6.8系统下搭建一个yum仓库,然后用另一台虚拟机访问该仓库.并安装程序包 安装ftp服务 查询ftp服务是否安装 [ro ...

  4. win8.1 环境下搭建PHP5.5.6+Apache2.4.7

    本文主要阐述在windows8及win8.1 环境下搭建PHP5.5.6+Apache2.4.7. 1.软件准备 apache 2.4.7:http://pan.baidu.com/s/1iUPif ...

  5. 【大数据系列】windows环境下搭建hadoop开发环境使用api进行基本操作

    前言 搭建完hadoop集群之后在windows环境下搭建java项目进行测试 操作hdfs中的文件 版本一 package com.slp.hadoop274.hdfs; import java.i ...

  6. Apache Nifi在Windows环境下搭建伪群集及证书登录

    代码地址如下:http://www.demodashi.com/demo/11986.html 前些时间做了关于Apache Nifi分布式集群的搭建分享,但很多时候要搭建分布式集群机器资源是个问题, ...

  7. Maven环境下搭建SSH框架之Spring整合Hibernate

    © 版权声明:本文为博主原创文章,转载请注明出处 1.搭建环境 Spring:4.3.8.RELEASE Hibernate:5.1.7.Final MySQL:5.7.17 注意:其他版本在某些特性 ...

  8. keepalived两台机器同时出现vip问题

    配置文件: 主:192.168.1.14 ! Configuration File for keepalived global_defs { script_user root enable_scrip ...

  9. ubuntu 14.04LTS 环境下搭建tftp服务器

    花费我一整天的时间在 ubuntu 14.04LTS 环境下搭建tftp服务器,网上好多资料参差不齐,简单来说,TFTP(Trivial File Transfer Protocol),是一个基于UD ...

随机推荐

  1. Python 3.X 练习集100题 03

    一个整数,它加上 100 后是一个完全平方数,再加上 168 又是一个完全平方数,请问该数是多少? import math for i in range(10000): n1 = math.sqrt( ...

  2. SQL系列(一)—— SQL简介

    在说到SQL之前需要了解一些关于数据库的概念: 数据库(database):是一个以某种有组织的方式存储的数据集合.存储数据的仓库,不过是以一定的组织方式进行存储. DBMS:数据库管理系统.经常遇到 ...

  3. Mysql系列(一)—— 基于5.7.22 解压版下载、安装、配置和卸载

    1.下载 从官网中直接获取自己想要的版本: MySQL Community Server 5.7.22 2.解压 将下载到的文件解压缩到自己喜欢的位置. 与mysql 5.6不同的是5.7版本中没有d ...

  4. -Shell 命令行工具 Cmder Babun Zsh MD

    目录 目录 Cmder:window 下增强型的 cmd + bash 简介 配置 解决中文乱码问题 添加到右键菜单 添加至环境变量 修改命令提示符号 自定义aliases Readme.md 设置c ...

  5. pands模块的妙用爬取网页中的表格

    拿我这篇为例https://www.cnblogs.com/pythonywy/p/11574340.html import pandas as pd df = pd.read_html('https ...

  6. 学习笔记之Django

    The Web framework for perfectionists with deadlines | Django https://www.djangoproject.com/ Django m ...

  7. 35、element ui tab切换加载echarts不显示或显示不全问题解决:

    <el-tabs v-model="activeName" @tab-click="handleClick" type="border-card ...

  8. 26、router.beforeEach路由拦截

    为了防止用户未登录直接修改路径来访问页面,解决办法: 在main.js文件中加入以下代码: // 路由拦截 router.beforeEach((to, from, next) => { if ...

  9. OpenFire后台插件上传获取webshell及免密码登录linux服务器

    1.目标获取 (1)fofa.so网站使用搜索body="Openfire, 版本: " && country=JP,可以获取日本存在的Openfire服务器.如图 ...

  10. Spring容器的refresh()介绍

    Spring容器的refresh()[创建刷新]; 1.prepareRefresh()刷新前的预处理; 1).initPropertySources()初始化一些属性设置;子类自定义个性化的属性设置 ...