[英]Time based apache web server load balancing
我在Apache Web服務器反向代理后面有兩個Tomcat節點,用於負載平衡。
我是否可以配置工作程序,以便僅在一天中的特定時間將其他主機添加到群集中?
盡管mod_jk
和mod_proxy_ajp
(或mod_proxy_http
)都沒有任何特定的功能來進行高負載調整大小(據我所知),但我絕對知道可以為許多后端實例(Tomcat節點)配置mod_jk
,但它們沒有所有這些都必須一直運行。
以以下配置為例:
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
,則可以使這些節點聯機,然后將這些工作h1t4
的激活狀態從S
(停止)更改為A
(活動)。 然后, mod_jk
將開始向這些可用節點發送請求。 當您要使它們脫機時,請再次將節點置於S
狀態(已停止),然后停止這些Tomcat實例。
Apache Tomcat連接器負載平衡方法中記錄了許多內容,而Apache Tomcat連接器工作程序參考中有完整參考 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.