Confluence Data Center ロード バランサの構成例
Crowd Data Center は、ロード バランサによってノード間のトラフィックのバランスを取っています。大規模な Crowd 環境ではすでにリバースプロキシを構成済みで、多くのリバース プロキシはロード バランシング機能も提供しています。
正確な構成は、使用するロード バランサによって異なります。ロード バランサは次の機能実現できる必要があります。
- アクティブな Crowd Data Center クラスタ ノードのいずれかへの HTTP/HTTPS トラフィックのルーティングを処理する
- ノードが利用可能かどうかを決定し、利用可能でなければ、利用可能な別のノードにリクエストをルーティングする
- セッション アフィニティ ("スティッキー セッション") を提供し、ユーザー セッション中のすべてのリクエストが同じノードに転送されるようにする。スティッキー セッションの処理は完全にロード バランサに委任することをおすすめします (アプリケーション ノードに依存するのではなく、ロード バランサでセッション cookie を設定する。以降の例をご覧ください)
- ヘルス チェックをサポートし、
http://<crowd-node>:8095/status; the <
(crowd-node>
はノードのホスト名または IP アドレス) でチェックを実行できるように構成できる。ノードが合理的な時間内に 200 OK HTTP 応答を返さない場合、ロード バランサはそのノードにトラフィックを転送するべきではありません。
例 Apache (mod_proxy_balancer を使用)
これは、mod_proxy_balancer を使用して受信リクエストを転送する Apache HTTP Server のサンプル設定です。この例では、選択したルートで ROUTEID cookie を設定し、その情報を使用して以降のリクエストを転送することでセッションの持続性を提供します。
crowd-cluster.conf
<VirtualHost *:80>
ProxyRequests off
ServerName MyCompanyServer
# This makes Apache set a ROUTEID cookie, to provide session affinity
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://crowdcluster>
# Crowd node 1 (make sure there are no trailing slashes after port number)
BalancerMember http://crowd1.internal.atlassian.com:8095 route=node1
# Crowd node 2 (make sure there are no trailing slashes after port number)
BalancerMember http://crowd2.internal.atlassian.com:8095 route=node2
# Security "we aren't blocking anyone but this the place to make those changes
Order Deny,Allow
Deny from none
Allow from all
# Load Balancer Settings, use the ROUTEID cookie to provide sticky sessions
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
# Here's how to enable the load balancer's management UI if desired
<Location /balancer-manager>
SetHandler balancer-manager
# You SHOULD CHANGE THIS to only allow trusted ips to use the manager
Order deny,allow
Allow from all
</Location>
# Don't reverse-proxy requests to the management UI
ProxyPass /balancer-manager !
# Reverse proxy all other requests to the Crowd cluster
ProxyPass / balancer://crowdcluster/
ProxyPreserveHost on
ProxyPassReverse / balancer://mycluster/
</VirtualHost>
例 HAProxy
これは、HAProxy のサンプル設定です。このサンプルでは、選択したルートで ROUTEID cookie を設定し、その情報を使用して以降のリクエストを転送することでセッションの持続性を提供します。
haproxy.cfg
global
log 127.0.0.1 local0
log 127.0.0.1 local1 debug
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
frontend localnodes
bind *:8000
mode http
default_backend nodes
backend nodes
mode http
balance roundrobin
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
cookie ROUTEID insert nocache
server node1 http://crowd1.internal.atlassian.com:8095 check cookie node1
server node2 http://crowd2.internal.atlassian.com:8095 check cookie node2
最終更新日 2017 年 8 月 16 日
Powered by Confluence and Scroll Viewport.