JBossは内部にTomcatを同梱していますが、そのTomcatのクラスタリングで必要な、セッションのレプリケーションの設定を勉強したので手順をメモっておきます。
WEBコンテナ1で ${install_root}/server/all/deploy/jbossweb-tomcat55.sar/server.xml
前: <Engine name="jboss.web" defaultHost="localhost" > 後: <Engine name="jboss.web" defaultHost="localhost" jvmRoute="tc1">
tc1はWEBコンテナ1に付けた名前。。
同様にWEBコンテナ2で jvmRoute="tc2" などとします。
http://sunsite.tus.ac.jp/pub/apache/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.6/
cp -pfr jakarta-tomcat-connectors-jk-1.2.6-linux-fc2-i386-apache-2.0.50.so /etc/httpd/modules/mod_jk.so chmod 755 /etc/httpd/modules/mod_jk.so
/etc/httpd/conf/workers.properties を作成します。
#Define tc1 <- このtc1は jvmRoute="tc1" とあわせる worker.tc1.port=8009 worker.tc1.host=xxxxxxxx <- ホスト名。IPアドレス worker.tc1.type=ajp13 worker.tc1.lbfactor=1 worker.tc1.local_worker=1 worker.tc1.cachesize=10 # Define tc2 <- このtc2は jvmRoute="tc2" とあわせる worker.tc2.port=8009 worker.tc2.host=yyyyyyyy <- ホスト名。IPアドレス worker.tc2.type=ajp13 worker.tc2.lbfactor=1 worker.tc2.local_worker=1 worker.tc2.cachesize=10 # Load-balancing behaviour worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tc1, tc2 worker.loadbalancer.sticky_session=1 worker.loadbalancer.local_worker_only=1 worker.list=loadbalancer
最後尾に
Include conf/mod-jk.conf
と追加しておきます。
vi /etc/httpd/conf/mod-jk.conf
# Load mod_jk module # Specify the filename of the mod_jk lib LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/workers.properties # Where to put jk logs JkLogFile logs/mod_jk.log # Set the jk log level [debug/ JkLogLevel info # Select the log format JkLogStampFormat "[%a %b # JkOptions indicates to send JkOptions +ForwardKeySize # JkRequestLogFormat JkRequestLogFormat "%w %V JkMount /JBossSamplesWeb/* loadbalancer
この記事は
現在のアクセス:7313