我完全是HAProxy的初学者,所以请任何建议都将是非常有用的。我在Microsoft Azure上有两个虚拟机。它们位于虚拟网络中,并且具有专用IP地址10.0.9.4和10.0.9.5。我在同一虚拟网络中的Microsoft Azure上创建了新的网络接口,IP地址为10.0.9.7。当然,这不会委派给任何虚拟机。
接口名称为:lb.oozie.local,专用IP地址10.0.9.7
我在.4和.5上添加了/etc/hosts
10.0.9.7 lb.oozie.local我在4号和5号机器上都安装了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地址(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调用的
请帮帮忙。先谢谢你,
发布于 2018-11-27 05:23:28
如果您想要在具有HA代理的VM前面使用负载均衡器来创建容错的一对HA代理,您需要创建一个前端IP为10.0.9.7的内部负载均衡器(而不是将10.0.9.7分配给NIC)。无法对负载均衡前端的前端IP执行ICMP ping操作,需要使用TCP ping。确保配置了健康探测,并直接看到来自HA代理VM的信号,而不是HA代理提供给客户端的端口(结果可能不是您想要的)。熟悉https://aka.ms/lbstandard上的标准负载均衡器,不要认为NSG必须将与标准LB一起使用的端口列入白名单。
https://stackoverflow.com/questions/52780944
复制相似问题