HAproxy

how to dynamically configure haproxy's front end and backend?

左心房为你撑大大i 提交于 2019-12-11 15:26:08
问题 I am totally lost on this one.How can haproxy's lu script be used to dynamically change values in the frontend and backend sections of haproxy.cfg. haproxy.cfg frontend http-in mode http bind 206.189.22.155:80 acl path-page-designer path_beg -i $PATH use_backend page-designer-backend if path-page-designer backend page-designer-backend mode http option httplog option forwardfor server appserver1 206.189.22.155:$PORT How can i change the value of $PATH and $PORT in the acl and backend

How to rate limit by HTTP status code with HAProxy?

穿精又带淫゛_ 提交于 2019-12-11 14:52:25
问题 HAProxy provides a built-in http_err_rate counter which “reports the average HTTP request error rate over that period.” This can be used in a stick table to rate-limit clients that are generating a lot of errors. That might look something like this: frontend web tcp-request content reject if { src_get_gpc0(Abuse) gt 0 } acl scanner src_http_err_rate(Abuse) ge 10 http-request deny if scanner flag_abuser backend Abuse stick-table type ip size 1m expire 60m store gpc0,http_err_rate(20s) What I'd

How to install HAProxy load balancer on Ubuntu

ⅰ亾dé卋堺 提交于 2019-12-11 13:51:42
Try this guide out on UpCloud with our free trial! Get started Load balancing is a common solution for distributing web applications horizontally across multiple hosts while providing the users with a single point of access to the service. HAProxy is one of the most popular open source load balancing software, which also offers high availability and proxy functionality. HAProxy aims to optimise resource usage, maximise throughput, minimise response time, and avoid overloading any single resource. It is available for install on many Linux distributions like Ubuntu 16 in this guide, but also on

Openshift Scalable Rails 4 new application renders 503 Server Unavailable

梦想的初衷 提交于 2019-12-11 11:54:59
问题 I successfully deployed a rails single gear application on openshift a few months ago. I am now attempting to deploy a scalable application. After setting up the app, connecting with git, pushing a minimalist project to openshift, I am getting a 503 Server Unavailable error. After doing quite a bit of research, I speculate my problem may be related to the HAProxy. The following post here goes into some detail about the haproxy and dealing with the cfg. I do have the same DOWN gears for my

How to Make HA Proxy to Follow Redirects by Itself?

北城余情 提交于 2019-12-11 10:28:22
问题 I have java client which talks to 3rd party service through HA Proxy. 3rd party service was recently changed, so now it is returning 302(Moved Temporarily) instead of 200(Ok) which causes failure on my java client cause it expects 200 with actual response. For a number of reasons I want to avoid any code changes to the java client. So, here is the question: Is there a way to make HA Proxy to follow redirects by itself and only return result(not 3xx http code) to the client? One more thing to

How to handle network calls in Microservices architecture

丶灬走出姿态 提交于 2019-12-11 07:39:19
问题 We are using Micro services architecture where top services are used for exposing REST API's to end user and backend services does the work of querying database. When we get 1 user request we make ~30k requests to backend service . We are using RxJava for top service so all 30K requests gets executed in parallel. We are using haproxy to distribute the load between backend services. However when we get 3-5 user requests we are getting network connection Exceptions, No Route to Host Exception,

HAProxy - URL redirection & rewriting

落花浮王杯 提交于 2019-12-11 07:26:40
问题 I am completely new to haproxy setup. I want to setup haproxy on top of tomcat servers. The below configuration works well for tomcat applications. global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 4096 user haproxy group haproxy defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 20000 contimeout 5000 clitimeout 50000 srvtimeout 50000 listen webfarm 100.100.100.100:80 mode http stats enable stats uri /haproxy?statis stats realm

How to enable keep-alive in haproxy?

做~自己de王妃 提交于 2019-12-11 07:25:09
问题 This is my haproxy.conf (haproxy 1.7.9) global log 127.0.0.1 local0 defaults retries 3 option redispatch timeout client 30s timeout connect 30s timeout server 30s option http-keep-alive http-reuse always frontend web1 bind *:8080 option http-keep-alive mode http default_backend app1 backend app1 balance roundrobin option http-keep-alive mode http server a2 192.168.56.150:8000 curl result of origin server: $ curl -vv http://192.168.56.150:8000/test --keepalive-time 700 * About to connect() to

Haproxy behind ELB

a 夏天 提交于 2019-12-11 05:17:59
问题 I have HAproxy is behind an AWS ELB. As soon as i remove the ELB, i can get the custom error page. but, with ELB in the front of Haproxy, i get HTTP/1.1 504 GATEWAY_TIMEOUT Content-Length: 0 Connection: keep-alive. Can anyone tell me what is going on please? Thanks errorfile: HTTP/1.0 403 Forbidden Cache-Control: no-cache Connection: close Content-Type: text/html <html><body><h1>403 Forbidden</h1> Request forbidden by administrative rules. </body></html> 回答1: Me and a coworker just had the

【架构】Nginx、HAProxy、LVS三者的优缺点分析

喜欢而已 提交于 2019-12-11 03:24:13
一、Nginx服务器 Nginx优点: 1、工作在网络7层之上,可针对http应用做一些分流的策略,如针对域名、目录结构,它的正规规则比HAProxy更为强大和灵活,所以,目前为止广泛流行。 2、Nginx对网络稳定性的依赖非常小,理论上能ping通就能进行负载功能。 3、Nginx安装与配置比较简单,测试也比较方便,基本能把错误日志打印出来。 4、可以承担高负载压力且稳定,硬件不差的情况下一般能支撑几万次的并发量,负载度比LVS小。 5、Nginx可以通过端口检测到服务器内部的故障,如根据服务器处理网页返回的状态码、超时等,并会把返回错误的请求重新提交到另一个节点。 6、不仅仅是优秀的负载均衡器/反向代理软件,同时也是强大的Web应用服务器。LNMP也是近些年非常流行的Web架构,在高流量环境中稳定性也很好。 7、可作为中层反向代理使用。 8、可作为静态网页和图片服务器。 9、Nginx社区活跃,第三方模块非常多,相关的资料在网上比比皆是。 Nginx常规的和HTTP请求和相应流程图: Nginx缺点: 1、适应范围较小,仅能支持http、https、Email协议。 2、对后端服务器的健康检查,只支持通过端口检测,不支持url来检测。比如用户正在上传一个文件,而处理该上传的节点刚好在上传过程中出现故障,Nginx会把上传切到另一台服务器重新处理,而LVS就直接断掉了