12.5. ISAPI を使用した基本的なクラスターの設定

タスク: 基本的なクラスタを提供するために ISAPI を設定する

このタスクでは、単一の IP アドレスですべてのサーバーで共通のアプリケーションを管理し、アプリケーション要求を適切なサーバーインスタンスにルーティングするために ISAPI を設定します。
ISAPI クラスタを設定する時にこの設定をサンプルとして使用します。

注記

このタスクは、負荷分散またはサーバー停止フェールオーバーに関する手順を提供しません。設定手順については、「ISAPI を使用した負荷分散クラスターの設定」 を参照してください。

前提条件

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

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

    重要

    isapi_redirect.properties ファイルは、isapi_redirect.dll ファイルと同じディレクトリに存在する必要があります。
    isapi_redirect.properties に次の情報を追加します。
    # 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
    
    #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 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 ファイルを作成する

    worker.properties ファイルには、ワーカーラベルとサーバーインスタンス間のマッピング定義が含まれます。以下の行をこのファイルに追加します。
    # An entry that lists all the workers defined
    worker.list=worker01, worker02
    
    # Entries that define the host and port associated with these workers
    
    # First 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 EAP server definition
    worker.worker02.host= 127.0.0.100
    worker.worker02.port=8009
    worker.worker02.type=ajp13
  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 ログとイベントビューアを確認する必要があります。