Articles of haproxy

HAProxy – 在SSL终止的前端使用ACL

我在nginx前面使用了HAProxy。 HAProxy终止SSL连接,并只将静态请求传递给nginx(png,jpg等)。 我不知道为什么,但有一些请求转发给非静态的nginx(例如:名称为“blank.htm”的文件)。 我的HAProxy的configuration是: frontend fe-safe bind 10.xxx:443 ssl crl /etc/haproxy/ssl.pem mode http option httplog option http-tunnel acl use_nginx path_end .js .css .jpg use_backend be_nginx if use_nginx default_backend be_default backend be_nginx server nginx1 127.0.0.1:5000 backend be_default server def1 xxxx:80 我正在使用版本1.5.4。 我无法find使用SSL终止时不支持ACL的信息。 也许不是? 谢谢你的帮助!

优化HAProxy SSL终止(在Ubuntu上使用Nginx后端)

我怎样才能优化HAProxy与SSL终止到Ubuntu的Nginx后端? 设置工作正常,路由正常。 但是,当我使用HAProxy执行SSL终止时,会有巨大的性能下降(下面的testing)。 关键是4096位的rsa。 HAProxy强制HTTPS进行validation,然后终止SSL,并将HTTP传输到后端Nginx服务器。 Nginx的服务器是相同的,并提供多个静态页面,即192.168.1.xx / page1.html,192.168.1.xx / page2.html等(我包括NodeJS为我的系统的完整性,但只增加了<1毫秒的延迟。可以忽略。) 这里是设置,configuration和当前的testing。 每个虚拟机(VM)运行Ubuntu 14.04,并且可以具有可变数量的CPU和RAM。 HAProxy(1.5.14):192.168.1.10 Nginx-1:192.168.1.20 Nginx-2:192.168.1.21 Nginx-3:192.168.1.22 NodeJS-1:192.168.1.30 这里是HAProxyconfiguration: global maxconn 40000 tune.ssl.default-dh-param 2048 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 # Default SSL material locations ca-base /etc/ssl/certs crt-base […]

Zabbix_server.log说 MySQL服务器已经消失

环境 CentOS 6.6,Zabbix 2.4 数据库MySQL Galera集群有3个节点 MySQL的-wsrep服务器,5.6-5.6.23-25.10.el6.x86_64 加莱拉,3-25.3.10-2.el6.x86_64 错误 [Z3005] query failed: [2006] MySQL server has gone away [select hostid,status from hosts where host='Zabbix server' and status in (0,1) and flags<>2 and proxy_hostid is null] [Z3005] query failed: [2006] MySQL server has gone away [begin;] [Z3005] query failed: [2006] MySQL server has gone away [begin;] […]

如何使用HAProxy进行其他ACL时进行基本身份validation?

我在Apache服务器前运行HAProxy,我想实现一些域的基本authentication。 该手册指出,这应该做的伎俩: userlist admins user myusername insecure-password mypassword frontend restricted_cluster acl auth_tintoretto http_auth(admins) http-request auth realm ShareaholicRestricted 但是,我有一些其他ACL,并在一个前端有几个域: frontend http-in # Define hosts acl stag_static hdr(host) -i staging.static.domain.com acl prod_static hdr(host) -i prod2.static.domain.com ## figure out which one to use use_backend apache-node1 if stag_static use_backend nginx-cluster if prod_static 我该如何结合这些命令才能限制访问stag_static?

如何为两个相同的Icecast主服务器设置自动故障转移反向代理?

我试图做一个简单的事情,在 Icecast主stream服务器的前端高可用性(即我不是在谈论Icecast中继这里) 的反向代理加倍 。 那么,三个虚拟机: 2个完全相同的独立Icecast虚拟机(每个虚拟机都有一个本地MPD音乐源和一个本地nginx前端,用于正确的头文件 ) 一个负载平衡器/反向代理nginx虚拟机。 我的问题是 – 如何configuration反向代理进行自动故障转移,以防Icecast虚拟机中的一个出现stream中断,并且stream客户端不中断? 插图: /— [ local nginx A <-> icecast master A <- mpd A] -> [nginx reverse proxy] —< \— [ local nginx B <-> icecast master B <- mpd B] 我第一次尝试这个简单的教程来设置一个反向代理nginx,之后我可以通过打开nginx虚拟机来听stream。 upstream backend { ip_hash; # try to send the same clients to the […]

马拉松集装箱与Haproxy负载平衡,领事随机返回503个请求

目前的架构是这样组织的: 192.168.1.10,192.168.1.11,192.168.1.12 – 与马拉松和领事服务器mesos大师 192.168.1.21,192.168.1.22,192.168.1.23 – 三名中间人与领事代理人 每台机器有以下configuration: 它自己的IP地址作为DNS服务器 HAPROXY with consul-template用于自动生成haproxy.cfg 用于注册正在运行的docker集装箱的主机IP地址的通知,以避免在从不同的机器parsing时在DNS中具有172.1.0.1地址的服务 我目前遇到的问题是,当我启动docker容器与桥接模式的服务,该地址是由DNS解决,因为它应该是(如果你有luigi.service.consul它将完成没有问题) ,但是当我尝试CURL -L http://luigi.service.consul/ ,我有随机503 error codes ,有时地址parsing,有时不是。 任何想法如何调查? 我检查了/etc/resolv.conf并且/etc/resolv.conf地,我可以看到DNS地址更改为旧的DNS IP地址(8.8.8.8),我应该使用主机IP地址作为DNS IP,还是我需要使用领事领导地址? 我已经尝试debuggingtcpflow,当响应是503,就像等待一段时间,就像它是无法解决的服务。

Haproxyredirect到不同的子域

我正在尝试使用haproxy将一个urlexample.com/blogredirect到blog.example.com。 我已经应用了以下规则: acl blog_path path_beg -i /blog/ redirect location http://blog.example.com/ code 301 if blog_path redirect工作正常,但有一个我不能解决的小故障。 如果我在浏览器中inputexample.com/blog/ ,它将被成功redirect到blog.example.com,但是如果我inputexample.com/blog 而不是/最后它会被redirect到blog.example.com/blog不会发生,对我来说很奇怪。 任何想法如何解决这个问题。

在haproxy中为CORS添加子域

我想在haproxy中做同样的事情,以允许我的域中的任何服务器使用CORS。 默认情况下,CORS只能做null,star或者一个URL。 那可能吗? SetEnvIf Origin "^(.*\.bebop\.co)$" ORIGIN_SUB_DOMAIN=$1 Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN 我已经添加了Access-Control-Allow-Credentials并将其设置为true,所以只需要更多一块。 非常感谢。

Haproxyparsing器不能更新健康检查失败的DNS

使用下面的(部分)conf文件haproxy 1.6.1(macros伟的软件!)。 在AWS(现场实例)closures后端服务器并进行replace时,会发生此问题。 新实例启动并运行后,统计信息页面仍然显示运行状况检查失败。 tcpdump向zos-e-e01.mycompany.com显示成功的传出查询到172.16.0.23。 看来haproxy正在查询IP地址,得到正确的响应,但不更新正在运行的configuration。 重新加载haproxy解决了这个问题。 resolvers aws nameserver aws1 172.16.0.23:53 resolve_retries 3 timeout retry 1s hold valid 30s backend zos cookie ZOS insert indirect nocache option httpchk GET /robots.txt HTTP/1.1\r\nHost:\ zos.mycompany.com balance leastconn no log option tcp-smart-connect server zos-e-c01 zos-e-c01.mycompany.com:80 cookie balancer.zos-e-c01 check port 80 inter 2000 rise 2 fall 3 maxconn 60 […]

Haproxy“nbproc 2”高CPU

我有一个单一的haproxy进程有95%的CPU使用率,所以我切换到nbproc 2 。 我有两个前端和两个后端, 我把1个前端和1个后端固定到了进程1,并且把剩下的两个固定到了进程2上。我期望CPU核心上的负载根据前端/后端组的负载进行分配,但是现在我有两个haproxy进程,一个使用20%的CPU,另一个使用95%的CPU。 为什么会这样? 我还没有断开连接,但是我将会开始在这个线程上使用更多的CPU。 configuration如下: global nbproc 2 maxconn 150000 user root # haproxy group root # haproxy daemon stats socket /var/run/haproxy.sock group haproxy mode 775 defaults mode tcp timeout connect 5000ms timeout client 130s timeout server 130s frontend http-in bind-process 2 bind *:80 mode http maxconn 40000 acl host_typea hdr(host) -i […]