24.9. Microsoft ISAPI コネクター

Internet Server API (ISAPI) は、Microsoft のインターネット情報サービス (IIS) などの Web サーバー用の Digital Server 拡張やフィルターを書き込むために使用される API のセットです。ISAPI_redirect.dll は IIS 向けに調整された mod_jk の拡張機能です。ISAPI_redirect.dll を使用すると、JBoss EAP インスタンスをワーカーノードとしてロードバランサーとして設定できます。

注記

Windows Server および IIS のサポートされる設定については、JBoss Enterprise Application Platform (EAP) 7 でサポートされる設定 を参照してください。

24.9.1. Microsoft IIS が ISAPI コネクターを使用するよう設定

Red Hat カスタマーポータルから ISAPI コネクターをダウンロードします。

  1. ブラウザーを開き、Red Hat カスタマーポータルで JBoss の Software Downloads ページにログインします。
  2. Product ドロップダウンメニューから Web Connectors を選択します。
  3. Version ドロップダウンメニューで最新バージョンの JBoss Core Services を選択します。
  4. リストで Red Hat JBoss Core Services ISAPI Connector を見つけ、Download リンクをクリックします。
  5. アーカイブを抽出し、sbin ディレクトリーの内容をサーバーの場所にコピーします。以下の手順は、内容が C:\connectors\ にコピーされたことを前提としています。

IIS マネージャー (IIS 7) を使用して IIS リディレクターを設定するには、以下を行います。

  1. StartRunとクリックして IIS マネージャーを開き、inetmgr と入力します。
  2. 左側のツリービューペインで IIS 7 をデプロイメントします。
  3. ISAPI and CGI Registrations をダブルクリックし、新しいウインドウで開きます。
  4. Actions ペインで Add をクリックします。Add ISAPI or CGI Restriction ウインドウが開きます。
  5. 以下の値を指定します。

    • ISAPI or CGI Path: C:\connectors\isapi_redirect.dll
    • Description: jboss
    • Allow extension path to execute: チェックボックスを選択します。
  6. OK をクリックして Add ISAPI or CGI Restriction ウインドウを閉じます。
  7. JBoss ネイティブ仮想ディレクトリーの定義

    • Default Web Site を右クリックし、Add Virtual Directory をクリックします。Add Virtual Directory ウインドウが開きます。
    • 以下の値を指定して仮想ディレクトリーを追加します。

      • Alias: jboss
      • Physical Path: C:\connectors\
    • OK をクリックして値を保存し、Add Virtual Directory ウインドウを閉じます。
  8. JBoss ネイティブ ISAPI リダイレクトフィルターの定義

    • ツリービューペインで SitesDefault Web Site とデプロイメントします。
    • ISAPI Filters をダブルクリックします。ISAPI Filters Features ビューが表示されます。
    • Actions ペインで Add をクリックします。Add ISAPI Filter ウインドウが表示されます。
    • 以下の値を Add ISAPI Filter ウインドウに指定します。

      • Filter name: jboss
      • Executable: C:\connectors\isapi_redirect.dll
    • OK をクリックして値を保存し、Add ISAPI Filter ウインドウを閉じます。
  9. ISAPI-dll ハンドラーの有効化

    • ツリービューペインの IIS 7 をダブルクリックします。IIS 7 Home Features View が開きます。
    • Handler Mappings をダブルクリックします。Handler Mappings Features View が表示されます。
    • Group by コンボボックスで State を選択します。Handler MappingsEnabled and Disabled Groups に表示されます。
    • ISAPI-dll を見つけます。Disabled グループにある場合は右クリックし、Edit Feature Permissions を選択します。
    • 以下のパーミッションを有効にします。

      • Read
      • Script
      • Execute
    • OK をクリックして値を保存し、Edit Feature Permissions ウインドウを閉じます。

これで、ISAPI コネクターを使用するよう Microsoft IIS が設定されます。

24.9.2. ISAPI コネクターがクライアントリクエストを JBoss EAP に送信するよう設定

このタスクでは、JBoss EAP サーバーのグループが ISAPI コネクターからのリクエストを受け入れるよう設定します。ロードバランシングまたは高可用性フェイルオーバーの設定は含まれません。

この設定は IIS サーバーで行われ、外部 Web サーバーからのリクエストを許可 するよう JBoss EAP が設定されていることを前提としています。また、IIS への完全な管理者アクセスが必要で、IIS が ISAPI コネクターを使用するよう設定 されている必要があります。

プロパティーファイルの作成およびリダイレクトの設定
  1. ログ、プロパティーファイル、およびロックファイルを格納するディレクトリーを作成します。

    以下の手順では、ディレクトリー C:\connectors\ の使用を前提としています。異なるディレクトリーを使用する場合は、適切に手順を変更してください。

  2. isapi_redirect.properties ファイルを作成します。

    C:\connectors\isapi_redirect.properties という新しいファイルを作成します。このファイルに次の内容をコピーします。

    # 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
    
    #Full path to the rewrite.properties file
    rewrite_rule_file=c:\connectors\rewrite.properties

    rewrite.properties ファイルを使用しない場合は、行の先頭に # 文字を記入して最後の行をコメントアウトします。

  3. uriworkermap.properties ファイルの作成

    uriworkermap.properties ファイルには、デプロイされたアプリケーション URL と、それらへの要求を処理するワーカー間のマッピングが含まれます。以下のサンプルファイルはファイルの構文を示しています。uriworkermap.properties ファイルを C:\connectors\ に格納します。

    # images and css files for path /status are provided by worker01
    /status=worker01
    /images/*=worker01
    /css/*=worker01
    
    # Path /web-console is provided by worker02
    # IIS (customized) error page is used for http errors with number greater or equal to 400
    # css files are provided by worker01
    /web-console/*=worker02;use_server_errors=400
    /web-console/css/*=worker01
    
    # Example of exclusion from mapping, logo.gif won't be displayed
    # !/web-console/images/logo.gif=*
    
    # Requests to /app-01 or /app-01/something will be routed to worker01
    /app-01|/*=worker01
    
    # Requests to /app-02 or /app-02/something will be routed to worker02
    /app-02|/*=worker02
  4. workers.properties ファイルを作成します。

    workers.properties ファイルには、ワーカーラベルとサーバーインスタンス間のマッピング定義が含まれます。このファイルは、 Apache mod_jk ワーカープロパティー 設定で使用される同じファイルの構文を使用します。

    以下は workers.properties ファイルの例になります。ワーカー名、worker01、および worker02 は、JBoss EAP の undertow サブシステムで設定 された instance-id に一致する必要があります。

    このファイルを C:\connectors\ ディレクトリーに格納してください。

    # An entry that lists all the workers defined
    worker.list=worker01, worker02
    
    # Entries that define the host and port associated with these workers
    
    # First JBoss EAP server definition, port 8009 is standard port for AJP in EAP
    worker.worker01.host=127.0.0.1
    worker.worker01.port=8009
    worker.worker01.type=ajp13
    
    # Second JBoss EAP server definition
    worker.worker02.host=127.0.0.100
    worker.worker02.port=8009
    worker.worker02.type=ajp13
  5. rewrite.properties ファイルを作成します。

    rewrite.properties ファイルには、特定のアプリケーションの単純な URL 書き換えルールが含まれます。以下の例で示されているように、書き換えられたパスは名前と値のペアを使用して指定されます。このファイルを C:\connectors\ ディレクトリーに格納してください。

    #Simple example
    # Images are accessible under abc path
    /app-01/abc/=/app-01/images/
  6. net stop および net start コマンドを使用して IIS サーバーを再起動します。

    C:\> net stop was /Y
    C:\> net start w3svc

アプリケーションごとに、設定した特定の JBoss EAP サーバーにクライアントリクエストを送信するよう IIS サーバーが設定されます。

24.9.3. ISAPI コネクターがクライアントリクエストを複数の JBoss EAP サーバーで分散するよう設定

この設定は、指定する JBoss EAP サーバー全体でクライアントリクエストを分散します。この設定は IIS サーバーで行われ、外部 Web サーバーからのリクエストを許可 するよう JBoss EAP が設定されていることを前提としています。また、IIS への完全な管理者アクセスが必要で、IIS が ISAPI コネクターを使用するよう設定 されている必要があります。

複数のサーバー間でのクライアント要求の分散
  1. ログ、プロパティーファイル、およびロックファイルを格納するディレクトリーを作成します。

    以下の手順では、ディレクトリー C:\connectors\ の使用を前提としています。異なるディレクトリーを使用する場合は、適切に手順を変更してください。

  2. isapi_redirect.properties ファイルを作成します。

    C:\connectors\isapi_redirect.properties という新しいファイルを作成します。このファイルに次の内容をコピーします。

    # 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

    rewrite.properties ファイルを使用しない場合は、行の先頭に # 文字を記入して最後の行をコメントアウトします。

  3. uriworkermap.properties ファイルを作成します。

    uriworkermap.properties ファイルには、デプロイされたアプリケーション URL と、それらへの要求を処理するワーカー間のマッピングが含まれます。以下のサンプルファイルは負荷分散が設定されたファイルの構文を示しています。ワイルドカード (*) はさまざまな URL サブディレクトリーのすべてのリクエストを router という名前のロードバランサーに送信します。ロードバランサーの設定は次のステップで説明します。

    uriworkermap.properties ファイルを C:\connectors\ に格納します。

    # 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
  4. workers.properties ファイルを作成します。

    workers.properties ファイルには、ワーカーラベルとサーバーインスタンス間のマッピング定義が含まれます。このファイルは、 Apache mod_jk ワーカープロパティー 設定で使用される同じファイルの構文を使用します。

    以下は workers.properties ファイルの例になります。ロードバランサーはファイルの末尾付近に設定され、ワーカー worker01 および worker02 で設定されます。これらのワーカーは、JBoss EAP の undertow サブシステム で設定された instance-id に一致する必要があります。

    このファイルを C:\connectors\ ディレクトリーに格納してください。

    # 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

  5. rewrite.properties ファイルを作成します。

    rewrite.properties ファイルには、特定のアプリケーションの単純な URL 書き換えルールが含まれます。以下の例で示されているように、書き換えられたパスは名前と値のペアを使用して指定されます。このファイルを C:\connectors\ ディレクトリーに格納してください。

    #Simple example
    # Images are accessible under abc path
    /app-01/abc/=/app-01/images/
    Restart the IIS server.
    
    Restart your IIS server by using the net stop and net start commands.
    C:\> net stop was /Y
    C:\> net start w3svc

IIS サーバーは、workers.properties ファイルで参照された JBoss EAP サーバーにクライアントリクエストを送信し、サーバー間で負荷を 1:3 の比率で分散するよう設定されます。この比率は、各サーバーに割り当てられた負荷分散係数 lbfactor から派生します。