[英]HAProxy - LB IP address is not delegated to virtual machines
我是HAProxy的初学者,所以任何建议都将非常有用。 我在Microsoft Azure上有两个虚拟机。 它们位于虚拟网络中,并且具有专用IP地址10.0.9.4和10.0.9.5。我在IP地址为10.0.9.7的同一虚拟网络中的Microsoft Azure上创建了新的网络接口。当然,这不会委托给任何虚拟机。
接口名称为: lb.oozie.local
,专用IP地址10.0.9.7
我在.4和.5的/ etc / hosts中添加了
10.0.9.7 lb.oozie.local
我在4和5 haconfig
机器上都安装了haproxy。haconfig文件如下:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats timeout 30s
#user haproxy
#group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL).
ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend localnodes
bind lb.oozie.local:80
mode http
default_backend nodes
backend nodes
mode http
balance roundrobin
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
server oozie1 10.0.9.4:11000 check
server oozie2 10.0.9.5:11000 check
listen stats lb.oozie.local:1936
stats enable
stats uri /haproxy?stats
我也做了:
sudo service haproxy restart
Redirecting to /bin/systemctl restart haproxy.service
验证返回以下内容:
haproxy -f /etc/haproxy/haproxy.cfg -c
[WARNING] 284/134546 (22658) : config : frontend 'GLOBAL' has no 'bind' directive. Please declare it as a backend if this was intended.
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result FAILED
Total: 3 (2 usable), will use epoll.
Using epoll() as the polling mechanism.
[WARNING] 284/134547 (22658) : Server nodes/oozie2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 284/134547 (22658) : sendto logger #1 failed: No such file or directory (errno=2)
[ALERT] 284/134547 (22658) : sendto logger #2 failed: No such file or directory (errno=2)
据我了解,我的服务器应该获得LB IP地址(10.0.9.7)。
我尝试从10.0.9.4和10.0.9.5 ping到10.0.9.7
但是在两台服务器上我都无法识别。
ping 10.0.9.7
PING 10.0.9.7 (10.0.9.7) 56(84) bytes of data.
From 10.0.9.4 icmp_seq=1 Destination Host Unreachable
From 10.0.9.4 icmp_seq=2 Destination Host Unreachable
另外,如果相关的话:我安装了keepalived机制我没有为负载均衡器地址设置公共IP地址,它只有专用IP 10.0.9.7,因为服务是直接从服务器10.0.9.4和10.0.9.5调用的
请帮忙。 先感谢您,
如果要在带有HA Proxy的VM之前使用Load Balancer创建一对容错的HA Proxies,则需要创建一个内部IP负载均衡器,其前端IP为10.0.9.7(而不是将10.0.9.7分配给NIC) )。 无法对负载均衡器前端的前端IP进行ICMP ping,而需要使用TCP ping。 确保已配置运行状况探针,并直接从HA Proxy VM看到信号,而不是从HA Proxy提供给客户端的端口(结果可能不是您想要的)。 通过https://aka.ms/lbstandard熟悉Standard Load Balancer,不要认为NSG必须将与Standard LB一起使用的端口列入白名单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.