HAProxy 基本配置 - 定义主后端
HAProxy basic configuration - defining primary backend
非常简单的问题 - 希望使用 HA 代理解决访问主服务器或辅助服务器的问题。
理想的系统是代理总是将用户定向到主节点,除非
1:主要在指定端口上没有响应或
2:我们告诉代理使用辅助
这会是使用带权重的轮询并为主要分配最大权重 256(?),为次要分配最大权重 1 的情况吗?
那么在这种情况下,如果 Primary 不可访问,则使用 secondary ?
并告诉系统使用哪个然后我们可以简单地交换权重或类似的?
谢谢
简单回答!在您的后端定义中,您可以将服务器标记为 "backup",如果非备份服务器不可用,HAProxy 只会将请求路由到这些服务器。来自 configuration manual:
When "backup" is present on a server line, the server is only used in
load balancing when all other non-backup servers are unavailable.
Requests coming with a persistence cookie referencing the server will
always be served though. By default, only the first operational backup
server is used, unless the "allbackups" option is set in the backend.
See also the "allbackups" option.
非常简单的问题 - 希望使用 HA 代理解决访问主服务器或辅助服务器的问题。 理想的系统是代理总是将用户定向到主节点,除非 1:主要在指定端口上没有响应或 2:我们告诉代理使用辅助 这会是使用带权重的轮询并为主要分配最大权重 256(?),为次要分配最大权重 1 的情况吗? 那么在这种情况下,如果 Primary 不可访问,则使用 secondary ? 并告诉系统使用哪个然后我们可以简单地交换权重或类似的?
谢谢
简单回答!在您的后端定义中,您可以将服务器标记为 "backup",如果非备份服务器不可用,HAProxy 只会将请求路由到这些服务器。来自 configuration manual:
When "backup" is present on a server line, the server is only used in load balancing when all other non-backup servers are unavailable. Requests coming with a persistence cookie referencing the server will always be served though. By default, only the first operational backup server is used, unless the "allbackups" option is set in the backend. See also the "allbackups" option.