ubuntu-14.04 – 使用强制持久设置的haproxy工作配置
我不确定我是否遗漏了一些关键的配置文件,或者只是从根本上误解了haproxy中强制持久的目的(在Ubuntu 14.04上使用版本1.5.11).从文档:
这听起来就像我想要的行为,在那里我可以将所有应用服务器置于“维护模式”以进行代码部署,但允许某些IP仍然连接,以便在重新启动每个人之前测试它,后推出.这是我设置的配置: global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin 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 ssl-default-bind-options no-sslv3 defaults log global mode http option httplog option dontlognull timeout connect 300s timeout client 50000 timeout server 50000 errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http listen mysite bind *:80 bind *:443 ssl crt mysite.pem http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc } redirect scheme https if !{ ssl_fc } balance roundrobin option forwardfor option httpchk HEAD /haproxy_health_check.php acl whitelist src -f /etc/haproxy/whitelist.lst force-persist if whitelist server app-1 10.1.4.32:80 maxconn 20 check inter 10000 有了这个配置,我想我应该能够发出以下命令: echo "disable server mysite/app-1" | socat /run/haproxy/admin.sock stdio 将单个应用服务器撤出,只要我来自/etc/haproxy/whitelist.lst中列出的IP地址,我仍然可以看到该网站,就好像服务器仍然启用一样.但是,我最终看到的是503错误页面,如果我是普通用户,我通常会发现这一点,但不是来自列入白名单的IP.为了消除我错误地指定IP地址或错误地使用acl命令的可能性,我尝试了一个变体,我只需设置: force-persist if TRUE 从我对文档的阅读中,我认为无论我来自哪个IP,我都不会禁用服务器.不幸的是我仍然得到503. 有一些笨拙的方法,包括传递额外的配置和重新加载haproxy,我可以使用它来使这个工作,但“强制持久”以及通过命令行禁用的方便能力似乎是一个更优雅的方法,我如果我能让它发挥作用,我肯定更喜欢它. 有没有其他人试图让haproxy以这种方式工作?以这种方式解释“强制坚持”我是错的吗?我是否需要一些额外的配置才能使其正常工作? 没有规则指出在此配置中要保留的内容.通常,您将使用此结合基于cookie的持久性.例如 :cookie SERVERID insert indirect nocache server srv1 1.1.1.1:80 cookie s1 check server srv2 2.2.2.2:80 cookie s2 check acl from_management_net src 10.0.0.0/8 force-persist if from_management_net 然后在您的客户端上,访问第一台服务器,获取分配的cookie,禁用服务器,然后再次访问它,您将继续前往那里.通常人们会实现一个特定的HTML页面,列出所有服务器及其各自的cookie,这有助于只需单击它们即可从客户端选择服务器. (编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Ubuntu下修改环境变量的三种方法
- ubuntu下如何安装android studio
- cassandra – 启用CQL二进制协议抛出YAMLExcepti
- 如何在Ubuntu Linux中执行CMU二进制炸弹?
- 在 Ubuntu 14.04 上编译 llvm 和 clang 3.8
- ubuntu – 如何使用–recv-keys而不是–recv添加
- Ubuntu使用apt-get update命令时提示Hash Sum mi
- Ubuntu常见错误--Could not get lock /var/lib/d
- Ubuntu的计算工作量令人失望
- Ubuntu 16.04下安装Cuda 8.0, Anaconda 4.4.0和T