首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >拒绝连接的HAProxy环境

拒绝连接的HAProxy环境
EN

Stack Overflow用户
提问于 2018-06-10 19:12:14
回答 1查看 675关注 0票数 0

我安装了一个带有2个webservices的HAProxy负载均衡器。在由3台服务器运行的服务上,响应很好,而只有一台服务器的另一种服务则没有响应。

基本上,这就是应该发生的事情:

负载平衡器

负载平衡器-所有其他请求的rancherServices

这是我的haproxy.cfg:

代码语言:javascript
复制
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend http-in
    bind *:80
    # Define hosts
    acl host_rancherAdmin hdr(host) -i admin.mydomain.tech

    use_backend rancherPlatformAdministration if host_rancherAdmin
    default_backend rancherServices

backend rancherServices
    balance roundrobin
    server rancherserver91 192.168.20.91:8080 check
    server rancherserver92 192.168.20.92:8080 check
    server rancherserver93 192.168.20.93:8080 check

backend rancherPlatformAdministration
    server rancherapi01 192.168.20.20:8081 check

wget --server-response foo.mydomain.tech回答一个401,这是尊重的行为,因为我没有提供用户名或密码。我也可以用我的浏览器打开foo.mydomain.tech登录。所以这部分就像我之前说过的。

wget --server-response 192.168.20.20:8081 (是的,这个Tomcat实际上运行在8081下)本地负载均衡器响应200,因此工作正常,而尝试wget --server-response admin.mydomain.tech的结果如下:

代码语言:javascript
复制
--2018-06-10 20:51:56--  http://admin.mydomain.tech/
Aufl"osen des Hostnamens admin.mydomain.tech (admin.mydomain.tech)... <PUBLIC IP>
Verbindungsaufbau zu admin.mydomain.tech (admin.mydomain.tech)|<PUBLIC IP>|:80 ... verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet ...
  HTTP/1.0 503 Service Unavailable
  Cache-Control: no-cache
  Connection: close
  Content-Type: text/html
2018-06-10 20:51:56 FEHLER 503: Service Unavailable.

我确信我在这里遗漏了一些东西;我意识到将请求作为第4层或第7层请求转发的不同之处--这似乎工作得很好。我提供mode http所以我在layer7..。

这里发生了什么,或者我如何调试它,有什么提示吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-10 21:31:17

事实证明,在我的例子中,selinux是展示的阻止者--在setenforce 0将它置于允许模式之后,它只是起了作用.由于此更改不是重新启动-持久的,所以我必须遵循以下说明:https://www.tecmint.com/disable-selinux-temporarily-permanently-in-centos-rhel-fedora/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50787186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档