フロントエンドのロードバランサーとしてApacheを使用してubuntuサーバーでテストTomcat Clustering
しました。session replication
私のテスト経験から、Tomcat クラスタリングを使用しない方がよいと思いますが、各ノードをスタンドアロンとして実行し、セッション レプリケーションを使用せずにお互いを認識しないようにする方がよいと言えます。速度が遅く、Tomcat サービスの起動に時間がかかり、より多くのメモリを消費すると感じたからです。また、FarmDeployer
展開では常に信頼できるとは限らず、構成全体を<Host></Host>
要素の下に配置して、ファーム デプロイヤーが機能するようにし、各仮想ホスティングと巨大な server.xml ファイルを配置する必要があります。以下は、私が使用したノードの 1 つからのクラスター構成の tomcat 仮想ホスティングです。
<Host name="site1.mydomain.net" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
<Context path="" docBase="/usr/share/tomcat/webapps/myapp" debug="0" reloadable="true"/>
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="192.168.1.8"
port="4001"
selectorTimeout="100"
maxThreads="6"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
<Member className="org.apache.catalina.tribes.membership.StaticMember"
port="4002"
securePort="-1"
host="192.168.1.9"
domain="staging-cluster"
uniqueId="{0,1,2,3,4,5,6,7,8,9}"/>
<!-- <Member className="org.apache.catalina.tribes.membership.StaticMember"
port="4002"
securePort="-1"
host="192.168.1.9"
domain="staging-cluster"
uniqueId="{0,1,2,3,4,5,6,7,8,9}"/> -->
</Interceptor>
</Channel>
<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/usr/share/tomcat/temp/"
deployDir="/usr/share/tomcat/webapps/"
watchDir="/usr/share/tomcat/watch/"
watchEnabled="true"/>
</Cluster>
</Host>
Tomcat クラスタリングは本番環境での使用に適していますか、それともセッション レプリケーションの別の方法はありますか? または、上記の構成で微調整できるものが欠けていますか?
どんなアイデアでも大歓迎です。ありがとう!