Som*_*guy 5 load-balancing haproxy
我正在使用 HAProxy 来平衡几个 Web 服务器(HTTP 模式)。Web 服务器是严格动态的,即没有任何静态内容,只有 Web 服务。
类型的 URL(类似)
http://192.168.5.10:8080/small
http://192.168.5.10:8080/medium
http://192.168.5.10:8080/large
Run Code Online (Sandbox Code Playgroud)
现在,当我将 HAProxy 配置为将传入请求转发到几台机器上的这 3 个 url 时,我正在使用acl
和path_end
/指定 url_path path_beg
,但是在放置请求时Not Found on Accelerator
出现错误,这使得定位问题变得更加困难。
下面是我正在使用的配置。此外,它没有记录任何错误。
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 10000
srvtimeout 10000
frontend http_proxy
bind 192.168.5.9:8888
acl is_small path_end -i small
acl is_medium path_end -i medium
acl is_large path_end -i large
use_backend web_server_small if is_small
use_backend web_server_medium if is_medium
use_backend web_server_large if is_large
backend web_server_small
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.10:8080 check
server web_2 192.168.5.11:8080 check
backend web_server_medium
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.12:8080 check
server web_2 192.168.5.13:8080 check
backend web_server_large
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.14:8080 check
server web_2 192.168.5.15:8080 check
Run Code Online (Sandbox Code Playgroud)
是否可以使用 url_path 将请求从 HAProxy 发送到 web_server?
如果 HAProxy 接收到它http://192.168.5.2:80/small
,则将请求发送到网络服务器作为http://192.168.5.10:8080/small
由于您的路径包含在 URL 的开头,为什么不使用 path_beg,建议将 path_end 用于文件扩展名。
acl is_small path_beg -i /small acl is_medium path_beg -i /medium acl is_large path_beg -i /large
归档时间: |
|
查看次数: |
27735 次 |
最近记录: |