12.6. ISAPI を使用した負荷分散クラスターの設定

タスク: 負荷分散クラスタを提供するために ISAPI を設定する

このタスクでは、すべてのサーバーで共通のアプリケーションを管理し、要求を JBoss Enterprise Application Platform インスタンスにルーティングし、一部のノードがオンラインでない場合や接続障害が発生した場合にライブノードに要求をリダイレクトするために ISAPI を設定します。
ISAPI クラスタを設定する時にこの設定をサンプルとして使用します。

前提条件

  1. isapi_redirect.properties ファイルを作成する

    C:\connectors\jboss-ep-5.1\native\sbin\ ディレクトリで isapi_redirect.properties という名前の新しいファイルを作成します。

    重要

    isapi_redirect.properties ファイルは、isapi_redirect.dll ファイルと同じディレクトリに存在する必要があります。
    以下の設定をファイルに追加します。
    # Configuration file for the ISAPI Redirector
    # Extension uri definition
    extension_uri=/jboss/isapi_redirect.dll
    
    # Full path to the log file for the ISAPI Redirector
    log_file=c:\connectors\isapi_redirect.log
    
    # Log level (debug, info, warn, error or trace)
    # Use debug only testing phase, for production switch to info
    log_level=debug
    
    # 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
  2. オプション: rewrite.properties ファイルを作成する

    rewrite.properties ファイルを使用すると、アプリケーションに固有の単純な URL 書き換えを指定できます。この設定ファイルはオプションであり、URL 書き換えが必要ない場合は isapi_redirect.properties から実行できます。
    提供される機能は Apache mod_rewrite に類似しますが、それほど強力ではありません。書き換えパスは名前と値のペアを使用して指定します。単純な例では、app_01 アプリケーションが、イメージを含む抽象的なディレクトリ名を持ち、そのディレクトリをもっと直感的なものに再マップします。
    #Simple example, images are accessible under abc path
    /app-01/abc/=/app-01/images/
  3. uriworkermap.properties ファイルを作成する

    uriworkermap.properties ファイルには、デプロイされたアプリケーションのマッピング設定情報が含まれます。以下の行をこのファイルに追加します。
    # images, css files, path /status and /web-console will provided by nodes defined in load-balancer
    /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 load-balancer
    /app-01|/*=router
    /app-02|/*=router
    
    # mapping for management console, nodes in cluster can be enabled or disabled here
    /jkmanager|/*=status
  4. workers.properties ファイルを作成する

    worker.properties ファイルには、ワーカーラベルとサーバーインスタンス間のマッピング定義が含まれます。以下の行をこのファイルに追加します。
    # 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

    注記

    workers.properties ディレクティブについては、付録A 参照:workers.properties を参照してください。
  5. IIS を再起動する

    変更内容を反映するために IIS サーバーを再起動します。実行している IIS バージョンに対して以下のコマンドを実行します。
    IIS 6
    C:\> net stop iisadmin /Y
    C:\> net start w3svc
    IIS 7
    C:\> net stop was /Y
    C:\> net start w3svc
  6. ログを検証する

    IIS が再起動されたら ISAPI ログを確認します。このログは isapi_redirect.propertieslog_file プロパティで指定されたファイルの場所に保存されます。また、他のイベントについて IIS ログとイベントビューアを確認する必要があります。