Enterprise Server では、Sun GlassFish Web Stack を使用できます。Web Stack は、Apache HTTP Server、PHP、Ruby などのコンポーネントを、あらかじめ統合およびバンドルしたものです。Sun GlassFish Web Stack の詳細は、http://www.sun.com/software/webstack/index.xml を参照してください。
Enterprise Server では、フロントエンドに Sun Java System Web Server、Apache Web Server、および Microsoft IIS を配置したロードバランサプラグインを使用することで、負荷分散のサポートも提供します。Enterprise Server に対するフロントエンドの方法には、mod_jk コネクタによる Apache httpd の使用もあります。
Enterprise Server クラスタを作成します。
JVM オプションを次のように定義します。
asadmin create-jvm-options --target cluster_name "-DjvmRoute=\${AJP_INSTANCE_NAME
asadmin create-jvm-options --target cluster_name "-Dcom.sun.enterprise.web.connector.enableJK=\${AJP_PORT}
クラスタの各インスタンスについて、JVM オプションの AJP_PORT および AJP_INSTANCE_NAME を次のコマンドで設定します。
asadmin create-system-properties --target instance_name AJP_INSTANCE_NAME=instance_name
asadmin create-system-properties --target instance_name AJP_PORT=port-number
クラスタを再起動します。
Apache httpd をインストールします。
Apache httpd は、http://httpd.apache.org/download.cgi から入手できます。
mod_jk をインストールします。
mod_jk コネクタは、http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/ から入手できます。
mof_jk.so ファイルに次の行を追加します。
LoadModule jk_module path_to_mod_jk.so JkWorkersFile /etc/apache2/worker.properties # Where to put jk logs JkLogFile /var/log/httpd/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel debug # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # Send all jsp requests to GlassFish JkMount /*.jsp loadbalancer. |
新しい /etc/apache2/worker.properties ファイルを作成し、次の行を追加します。
# Define 1 real worker using ajp13 worker.list=loadbalancer # Set properties for instance1 worker.instance1.type=ajp13 worker.instance1.host=localhost worker.instance1.port=9090 worker.instance1.lbfactor=50 worker.instance1.cachesize=10 worker.instance1.cache_timeout=600 worker.instance1.socket_keepalive=1 worker.instance1.socket_timeout=300 # Set properties for instance2 worker.instance2.type=ajp13 worker.instance2.host=localhost worker.instance2.port=9091 worker.instance2.lbfactor=50 worker.instance2.cachesize=10 worker.instance2.cache_timeout=600 worker.instance2.socket_keepalive=1 worker.instance2.socket_timeout=300 # Set properties for instance3 worker.instance3.type=ajp13 worker.instance3.host=localhost worker.instance3.port=9092 worker.instance3.lbfactor=50 worker.instance3.cachesize=10 worker.instance3.cache_timeout=600 worker.instance3.socket_keepalive=1 worker.instance3.socket_timeout=300 worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=instance1,instance2,instance3 |
tomcat-ajp.jar ファイルを、Apache 5.5.x のインストールから Enterprise Server の lib ディレクトリにコピーします。
commons-logging.jar (version 1.1.1) および commons-modeler.jar (version 2.0.1) ファイルを、Jakarta Commons Web サイトの http://commons.apache.org からコピーします。
クラスタを再起動し、httpd を起動します。