使用clone和clusterip启动pacemaker虚拟ip负载平衡

我正在尝试为一组natted机器制作一个负载均衡的网关。 我有3个centos节点。 最初只有一个节点应该有内部网关IP,并且运行良好。 交通stream量。

然后,我尝试通过clusterip_hash / clone选项来平衡网关。 在底部有一个资源创build与个人电脑,我的小地点限制(不要移动IP到一台没有“互联网”的机器),最后是克隆命令。

一旦我克隆资源,我可以看到他们在两个主机上正确运行,并且每个都添加了iptables规则:

Chain INPUT (policy DROP) target prot opt source destination CLUSTERIP all -- anywhere gateway CLUSTERIP hashmode=sourceip-sourceport clustermac=81:48:85:71:7F:47 total_nodes=2 local_node=2 hash_init=0 

问题是,只要arp条目从当前的任一网关机器的真实物理mac改变到iptables中显示的clustermac,所有的natted机器就会松动互联网连接。

我添加iptableslogging丢弃的数据包,但似乎没有丢弃。 同时,似乎没有任何事情可以通过。 (10.10.0.52是一个随机挑选的natted主机,试图ping谷歌,如果虚拟IP克隆被删除,并改变为单个浮动IP,然后stream量再次stream动)

 [root@three ~]# tcpdump -nni enp1s0 icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp1s0, link-type EN10MB (Ethernet), capture size 65535 bytes 16:40:36.898612 IP 10.10.0.52 > 8.8.8.8: ICMP echo request, id 18875, seq 188, length 64 16:40:37.906651 IP 10.10.0.52 > 8.8.8.8: ICMP echo request, id 18875, seq 189, length 64 

起搏器configuration,通过个人电脑完成:

 pcs resource create ip_internal_gw ocf:heartbeat:IPaddr2 params ip="10.10.0.250" cidr_netmask="24" nic="enp1s0" clusterip_hash="sourceip-sourceport" op start interval="0s" timeout="60s" op monitor interval="5s" timeout="20s" op stop interval="0s" timeout="60s" pcs resource clone ip_internal_gw meta globally-unique=true master-max="2" master-node-max="2" clone-max="2" clone-node-max="1" notify="true" interleave="true" pcs constraint location ip_internal_gw rule id=ip_internal_gw_needs_internet score=-INFINITY not_defined pingd or pingd lte 0 [root@three ~]# pcs status Cluster name: Last updated: Wed May 25 16:51:15 2016 Last change: Wed May 25 16:35:53 2016 by root via cibadmin on two.gateway.shire Stack: corosync Current DC: two.gateway.shire (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum 3 nodes and 5 resources configured Online: [ one.gateway.shire three.gateway.shire two.gateway.shire ] Full list of resources: Clone Set: ping-clone [ping] Started: [ one.gateway.shire three.gateway.shire two.gateway.shire ] Clone Set: ip_internal_gw-clone [ip_internal_gw] (unique) ip_internal_gw:0 (ocf::heartbeat:IPaddr2): Started three.gateway.shire ip_internal_gw:1 (ocf::heartbeat:IPaddr2): Started two.gateway.shire 

什么阻止了stream量? 我确定我缺less一些基本的东西。

看起来:

 iptables -A PREROUTING -t mangle -i eth0 -m cluster --cluster-total-nodes 2 --cluster-local-node 1 --cluster-hash-seed 0xdeadbeef -j MARK --set-mark 0xffff iptables -A PREROUTING -t mangle -i enp1s0 -m cluster --cluster-total-nodes 2 --cluster-local-node 1 --cluster-hash-seed 0xdeadbeef -j MARK --set-mark 0xffff 

帮助它运行。