17.9.5. ISAPI コネクターがクライアントリクエストを複数の JBoss EAP 6 サーバーで分散するよう設定
概要
この設定は、指定する JBoss EAP 6 サーバー全体でクライアントリクエストを分散します。デプロイメントごとに特定の JBoss EAP 6 サーバーにクライアントリクエストを送信する場合は、代わりに 「ISAPI コネクターがクライアントリクエストを JBoss EAP 6 に送信するよう設定」 を参照してください。
前提条件
- IIS サーバーへの完全な管理者アクセス。
手順17.24 複数のサーバー間でのクライアント要求の分散
ログ、プロパティーファイル、およびロックファイルを格納するディレクトリーを作成します。
この手順では、ディレクトリーC:\connectors\
の使用を前提としています。異なるディレクトリーを使用する場合は、適切に手順を変更してください。isapi_redirect.properties
ファイルを作成します。C:\connectors\isapi_redirect.properties
という新しいファイルを作成します。このファイルに次の内容をコピーします。Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configuration file for the ISAPI Connector Extension uri definition Full path to the log file for the ISAPI Connector Log level (debug, info, warn, error or trace) Full path to the workers.properties file Full path to the uriworkermap.properties file
# Configuration file for the ISAPI Connector # Extension uri definition extension_uri=/jboss/isapi_redirect.dll # Full path to the log file for the ISAPI Connector log_file=c:\connectors\isapi_redirect.log # Log level (debug, info, warn, error or trace) log_level=info # Full path to the workers.properties file worker_file=c:\connectors\workers.properties # Full path to the uriworkermap.properties file worker_mount_file=c:\connectors\uriworkermap.properties #OPTIONAL: Full path to the rewrite.properties file rewrite_rule_file=c:\connectors\rewrite.properties
uriworkermap.properties
ファイルを作成します。uriworkermap.properties
ファイルには、デプロイされたアプリケーション URL と、それらへの要求を処理するワーカー間のマッピングが含まれます。以下のサンプルファイルは負荷分散が設定されたファイルの構文を示しています。ワイルドカード(*
)文字は、さまざまな URL サブディレクトリーのすべてのリクエストをrouter
というロードバランサーに送信します。ロードバランサーの設定は、ステップ 4 で説明されています。uriworkermap.properties
ファイルをC:\connectors\
に配置します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow images, css files, path /status and /web-console will be provided by nodes defined in the load-balancer called "router" Example of exclusion from mapping, logo.gif won't be displayed /web-console/images/logo.gif=* Requests to /app-01 and /app-02 will be routed to nodes defined in the load-balancer called "router" mapping for management console, nodes in cluster can be enabled or disabled here
# images, css files, path /status and /web-console will be # provided by nodes defined in the load-balancer called "router" /css/*=router /images/*=router /status=router /web-console|/*=router # Example of exclusion from mapping, logo.gif won't be displayed # /web-console/images/logo.gif=* # Requests to /app-01 and /app-02 will be routed to nodes defined # in the load-balancer called "router" /app-01|/*=router /app-02|/*=router # mapping for management console, nodes in cluster can be enabled or disabled here /jkmanager|/*=status
workers.properties
ファイルを作成します。workers.properties
ファイルには、ワーカーラベルとサーバーインスタンス間のマッピング定義が含まれます。以下のサンプルファイルはファイルの構文を示しています。ロードバランサーはファイルの末尾付近に設定され、ワーカーworker01
およびworker02
で構成されます。workers.properties
ファイルは、Apache mod_jk 設定に使用される同じファイルの構文に従います。workers.properties
ファイルの構文に関する詳細は、「Apache mod_jk ワーカーの設定リファレンス」 を参照してください。このファイルをC:\connectors\
ディレクトリーに置きます。Copy to Clipboard Copied! Toggle word wrap Toggle overflow The advanced router LB worker First EAP server definition, port 8009 is standard port for AJP in EAP lbfactor defines how much the worker will be used. The higher the number, the more requests are served lbfactor is useful when one machine is more powerful ping_mode=A – all possible probes will be used to determine that connections are still working Second EAP server definition Define the LB worker Define the status worker for jkmanager
# The advanced router LB worker worker.list=router,status # First EAP server definition, port 8009 is standard port for AJP in EAP # # lbfactor defines how much the worker will be used. # The higher the number, the more requests are served # lbfactor is useful when one machine is more powerful # ping_mode=A – all possible probes will be used to determine that # connections are still working worker.worker01.port=8009 worker.worker01.host=127.0.0.1 worker.worker01.type=ajp13 worker.worker01.ping_mode=A worker.worker01.socket_timeout=10 worker.worker01.lbfactor=3 # Second EAP server definition worker.worker02.port=8009 worker.worker02.host=127.0.0.100 worker.worker02.type=ajp13 worker.worker02.ping_mode=A worker.worker02.socket_timeout=10 worker.worker02.lbfactor=1 # Define the LB worker worker.router.type=lb worker.router.balance_workers=worker01,worker02 # Define the status worker for jkmanager worker.status.type=status
rewrite.properties
ファイルを作成します。rewrite.properties
ファイルには、特定のアプリケーションの単純な URL 書き換えルールが含まれます。以下の例で示されているように、書き換えられたパスは名前と値のペアを使用して指定されます。このファイルをC:\connectors\
ディレクトリーに置きます。Copy to Clipboard Copied! Toggle word wrap Toggle overflow Images are accessible under abc path
#Simple example # Images are accessible under abc path /app-01/abc/=/app-01/images/
IIS サーバーを再起動します。
net stop コマンドおよび net start コマンドを使用して IIS サーバーを再起動します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow net stop was /Y net start w3svc
C:\> net stop was /Y C:\> net start w3svc
結果
IIS サーバーは、workers.properties
ファイルで参照されている JBoss EAP 6 サーバーにクライアントリクエストを送信し、サーバー間で負荷を 1:3 の比率で分散するよう設定されます。この比率は、各サーバーに割り当てられた負荷分散係数(lbfactor
)から派生します。