【发布时间】:2019-03-17 18:27:02
【问题描述】:
我是 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 上都安装了 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 调用的
请帮忙。 提前谢谢你,
【问题讨论】:
标签: azure load-balancing haproxy keep-alive