我目前有一个HAproxy负载均衡器设置,带有2个后端,总共3个网站。其中一个网站需要一个额外的服务器(一个新的后端,后端#3),但其他人不必使用这个后端。有没有办法做到这一点?可悲的是,我无法使用文档来解决这个问题。配置补充。新的后端将是.77。谢谢!
private static final int
答案 0 :(得分:0)
关于“后端”一词的说明:您在问题中使用它来描述将转发请求的服务。为避免混淆,我将在backend
处使用server
,backend
将成为一组server
(以匹配HAProxy术语)。
您需要两个frontend
块,一个带有两个frontend www-http
[...]
acl host_website3 hdr(host) -i website3.com # match the new website
use_backend www-backend-with3 if host_website3 # send it to the correct backend
default_backend www-backend
backend www-backend
redirect scheme https if !{ ssl_fc }
cookie SERVERID insert indirect nocache
server www-1 192.168.3.75:80 check cookie www-1
server www-2 192.168.3.74:80 check cookie www-2
backend www-backend-with3 # new backend here
redirect scheme https if !{ ssl_fc }
cookie SERVERID insert indirect nocache
server www-1 192.168.3.75:80 check cookie www-1
server www-2 192.168.3.74:80 check cookie www-2
server www-3 192.168.3.77:80 check cookie www-3 # with a new server here
,另一个带有三个OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf
OK: Policy file accepted: https://foo.com/crossdomain.xml
OK: Request for resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf is permitted due to policy file at https://foo.com/crossdomain.xml
。在OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at
https://foo.com/flash/flash.swf
by requestor from http://bar.com/flash/new.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at
https://foo.com/flash/flash.swf
by requestor from http://bar.com/flash/new.swf
Warning: [strict] Policy file requested from
https://foo.com/crossdomain.xml redirected to https://foo.com/crossdomain.xml; will use final URL in determining scope. See http://www.adobe.com/go/strict_policy_files if this causes problems.
OK: Policy file accepted: https://foo.com/crossdomain.xml
Error: Request for resource at
https://foo.com/flash/flash.swf
by requestor from http://bar.com/flash/new.swf is denied due to lack of policy file permissions.
中,使用主机名选择正确的名称:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>