基于时间的 apache web 服务器负载平衡
Time based apache web server load balancing
我在用于负载平衡的 Apache Web 服务器反向代理后面有两个 Tomcat 节点。
我有没有办法配置 worker,以便仅在一天中的特定时间将额外的主机添加到集群?
尽管 mod_jk
和 mod_proxy_ajp
(或 mod_proxy_http
)都没有任何针对高负载调整大小的特定功能(据我所知),但我绝对知道 mod_jk
可以为多个后端实例(Tomcat 个节点)配置,它们不必一直都是 运行。
以如下配置为例:
worker.list=T1lb, T2lb, T3lb, T4lb
worker.T1lb.type-lb
worker.T1lb.balance_workers=h1t1, h2t1, h3t1, h4t1
worker.T2lb.type-lb
worker.T2lb.balance_workers=h1t2, h2t2, h3t2, h4t2
[etc for other combinations of TXlb]
worker.h1t1.host=host1.internal
worker.h1t1.port=1111
worker.h1t1.ping_mode=A
worker.h1t2.host=host1.internal
worker.h1t2.port=2222
worker.h1t2.ping_mode=A
worker.h1t3.host=host1.internal
worker.h1t3.port=3333
worker.h1t3.ping_mode=A
worker.h1t4.host=host1.internal
worker.h1t4.port=4444
worker.h1t4.ping_mode=A
[etc for other combinations of hXtY]
如果您只是关闭(或不启动)h1t3
和 h1t4
的 Tomcat 个节点,那么 mod_jk
将知道它们不可用并且不会向他们发送请求。当您启动它们时,它们会开始接受请求。
此配置还有另一个选项。它更干净一些,但需要更多的工作。
你的配置和上面一样,但是你显式地将你平时不在线的节点的activation
状态设置为disabled
,像这样:
worker.h1t3.host=host1.internal
worker.h1t3.port=3333
worker.h1t3.ping_mode=A
worker.h1t3.activation=S
worker.h1t4.host=host1.internal
worker.h1t4.port=4444
worker.h1t4.ping_mode=A
worker.h1t4.activation=S
如果您想要启动节点 h1t3
和 h1t4
,那么您需要将这些节点联机,然后将这些工作节点的激活状态从 S
(停止) 到 A
(活动)。然后,mod_jk
将开始向那些可用节点发送请求。当你想让它们脱机时,再次将节点置于 S
状态(已停止),然后停止那些 Tomcat 个实例。
Apache Tomcat 连接器 load balancing howto, with a full reference in the Apache Tomcat Connectors worker reference.
中记录了很多内容
我在用于负载平衡的 Apache Web 服务器反向代理后面有两个 Tomcat 节点。
我有没有办法配置 worker,以便仅在一天中的特定时间将额外的主机添加到集群?
尽管 mod_jk
和 mod_proxy_ajp
(或 mod_proxy_http
)都没有任何针对高负载调整大小的特定功能(据我所知),但我绝对知道 mod_jk
可以为多个后端实例(Tomcat 个节点)配置,它们不必一直都是 运行。
以如下配置为例:
worker.list=T1lb, T2lb, T3lb, T4lb
worker.T1lb.type-lb
worker.T1lb.balance_workers=h1t1, h2t1, h3t1, h4t1
worker.T2lb.type-lb
worker.T2lb.balance_workers=h1t2, h2t2, h3t2, h4t2
[etc for other combinations of TXlb]
worker.h1t1.host=host1.internal
worker.h1t1.port=1111
worker.h1t1.ping_mode=A
worker.h1t2.host=host1.internal
worker.h1t2.port=2222
worker.h1t2.ping_mode=A
worker.h1t3.host=host1.internal
worker.h1t3.port=3333
worker.h1t3.ping_mode=A
worker.h1t4.host=host1.internal
worker.h1t4.port=4444
worker.h1t4.ping_mode=A
[etc for other combinations of hXtY]
如果您只是关闭(或不启动)h1t3
和 h1t4
的 Tomcat 个节点,那么 mod_jk
将知道它们不可用并且不会向他们发送请求。当您启动它们时,它们会开始接受请求。
此配置还有另一个选项。它更干净一些,但需要更多的工作。
你的配置和上面一样,但是你显式地将你平时不在线的节点的activation
状态设置为disabled
,像这样:
worker.h1t3.host=host1.internal
worker.h1t3.port=3333
worker.h1t3.ping_mode=A
worker.h1t3.activation=S
worker.h1t4.host=host1.internal
worker.h1t4.port=4444
worker.h1t4.ping_mode=A
worker.h1t4.activation=S
如果您想要启动节点 h1t3
和 h1t4
,那么您需要将这些节点联机,然后将这些工作节点的激活状态从 S
(停止) 到 A
(活动)。然后,mod_jk
将开始向那些可用节点发送请求。当你想让它们脱机时,再次将节点置于 S
状态(已停止),然后停止那些 Tomcat 个实例。
Apache Tomcat 连接器 load balancing howto, with a full reference in the Apache Tomcat Connectors worker reference.
中记录了很多内容