Top / JBoss / Tomcatのクラスタリング

JBossは内部にTomcatを同梱していますが、そのTomcatのクラスタリングで必要な、セッションのレプリケーションの設定を勉強したので手順をメモっておきます。

WEBコンテナに名前を付ける

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" などとします。

mod_jkのダウンロード

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

workers.propertiesの作成

/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

httpd.confへconfファイルを追加

最後尾に

Include conf/mod-jk.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

関連リンク


この記事は

選択肢 投票
おもしろかった 2  
そうでもない 0  

Top / JBoss / Tomcatのクラスタリング

現在のアクセス:7292


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-06-01 (金) 16:36:36 (4340d)