Tomcat5.5でクラスタリングを行います。
VirtualBoxを使って、Windowsマシン上でDebianを動作させてます。
OS |
IPアドレス |
Debian4.0 |
192.168.1.5 |
WindowsXP |
192.168.1.9 |
【server.xmlの編集】
Tomcat5.5では、<Cluster>タグのコメントを解除すればクラスタリングが行える。
さらに、ファーミング機能を使いたいと思います。
ファーミングは、1台のマシンにWARファイルを転送すると、全てのマシンにデプロイ(配置)される仕組みです。DebianのTomcatのserver.xmlの<Cluster>タグは、以下のように変更しました。
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="5000"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"
waitForAck="true"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/usr/local/tomcat5.5/temp/"
deployDir="/usr/local/tomcat5.5/webapps/"
watchDir="/usr/local/tomcat5.5/listen/"
watchEnabled="true"/>
<ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
</Cluster> |
ファーミングは<Deployer>タグに記述することで動作します。
WindowsのTomcatの場合も同様に、インストールしたディレクトリを指定します。
tempDir="/usr/local/tomcat5.5/temp/" |
作業用 |
deployDir="/usr/local/tomcat5.5/webapps/" |
ここにデプロイされる |
watchDir="/usr/local/tomcat5.5/listen/" |
WARファイルを監視する |
watchEnabled="true" |
ファーミングを実行 |
参考サイト
www.thinkit.co.jp/cert/compare/14/1/4.htm
www.thinkit.co.jp/cert/compare/14/2/3.htm
m97087yh.seesaa.net/category/5814610-5.html
www.iwahrt.com/iwahrt/ListProblemSolution.do
PR