AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 104350
Accepted
morgant
morgant
Asked: 2010-01-20 13:43:37 +0800 CST2010-01-20 13:43:37 +0800 CST 2010-01-20 13:43:37 +0800 CST

为什么我的 HAProxy 内容切换配置中出现错误?

  • 772

我正在将一些基础架构从托管特定站点的多个服务器迁移到在 OpenBSD 4.6 macppc 上使用HAProxy 1.3.15.7 的负载平衡架构。自然,我从为当前设置(特定服务器上的特定站点)配置内容切换开始,我的 /etc/haproxy/haproxy.cfg 如下:

global
    log 127.0.0.1   local0
    log 127.0.0.1   local1 notice
    #log loghost    local0 info
    maxconn 1024
    chroot /var/haproxy
    uid 604
    gid 604
    daemon
    #debug
    #quiet
    pidfile /var/run/haproxy.pid

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    option  redispatch
    retries 3
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000
    stats enable
    stats auth user:pass

frontend http_proxy *:80
    # check to see which domain the reguest is for
    acl host_tld.domain.sub1 hdr_end(host) sub1.domain.tld
    acl host_tld.domain.sub2 hdr_end(host) sub2.domain.tld
    # send to the correct server
    use_backend server2 if host_tld.domain.sub1 or host_tld.domain.sub2
    default_backend server1

backend server1
    server httpd_server1 192.168.1.3:80

backend server2
    server httpd_server2 192.168.1.4:80

目标是为所有域提供服务,server1除了域sub1.domain.tld&sub2.domain.tld应该被抛出server2。但是,当我尝试启动 HAProxy 时,出现以下错误:

parsing /etc/haproxy/haproxy.cfg : backend 'server2' has no dispatch address and is not in transparent or balance mode.
parsing /etc/haproxy/haproxy.cfg : backend 'server1' has no dispatch address and is not in transparent or balance mode.
Errors found in configuration file, aborting.
Error reading configuration file : /etc/haproxy/haproxy.cfg

我查看了 HAProxy 1.3 文档和http://upstre.am/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/中列出的示例,但没有看到我哪里出错了。这些示例似乎都不需要option transparent平衡模式。此外,dispatch1.3 文档中奇怪地省略了该选项的文档,但我怀疑它对我的故障排除有帮助。

我哪里出错了?

openbsd http-proxy haproxy
  • 1 1 个回答
  • 4336 Views

1 个回答

  • Voted
  1. Best Answer
    Willy Tarreau
    2010-01-21T12:58:13+08:002010-01-21T12:58:13+08:00

    您忘记了“平衡循环”(或等效)这一行,因为您需要在后端有一个平衡算法。另外,你正在做内容切换,所以请在你的前端或默认部分添加“选项 httpclose”,否则第二次保持连接请求将无法匹配。

    • 2

相关问题

  • OpenBSD 和文件系统快照

  • 针对 Active Directory 对 OpenBSD 进行身份验证

  • HTTP -> HTTPS 重定向与 OpenBSD 的 httpd [关闭]

  • OpenBSD 4.4 上的 ichiic0 错误

  • OpenBSD 安装在 2 个切片上

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve