您可以將 Enterprise Server 配合 Sun GlassFish 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 成為前端的另一項技術是使用 Apache httpd 配合 mod_jk 連接器。
建立 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。
您可以從 http://httpd.apache.org/download.cgi取得 Apache httpd
安裝 mod_jk。
您可以從 http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/取得 mod_jk 連接器
新增下列各行指令到 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 |
從 Apache 5.5.x 安裝將 tomcat-ajp.jar 檔案複製到 Enterprise Server lib 目錄。
從 Jakarta Commons 網站複製commons-logging.jar (1.1.1 版) 和 commons-modeler.jar (2.0.1 版) 檔案,網址為:http://commons.apache.org。
重新啟動叢集並啟動 httpd