tomcat的jvm和session同步配置

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://ligang.blog.csdn.net/article/details/41213221

今天修改tomcat的jvm和配置session同步时,重启tomcat发现了几个错误:

一、部署tomcat 6.0.20,使用sh startup.sh启动tomcat 出现This file is needed to run this program

原因.sh文件都不是可执行文件,于是找到命令:

<pre name="code" class="plain">chmod +x *.sh  
chmod +x *.sh再次执行 sh catalina.sh通过,然后用sh startup.sh成功启动
例如:chmod 777 /opt/tomcat6_8081/bin/catalina.sh

二、查看当前tomcat是否被占用:

<pre name="code" class="plain"> ps -ef|grep tomcat

JVM内存配置(/bin/catalina.sh 最顶部即可):

<pre name="code" class="plain">JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1024m -Xmx2048m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

tomcat共享session配置(/conf/server.xml <Engine>标签中):

<span style="font-size:14px;"><Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
  <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" maxInactiveInterval="28800" />
  <Channel className="org.apache.catalina.tribes.group.GroupChannel">
    <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="5000" />
    <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4000" autoBind="100" selectorTimeout="10000" maxThreads="150" />
    <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
      <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" />
    </Sender>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor" />
  </Channel>
  <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter="" />
  <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve" />
  <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false" />
  <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener" />
  <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener" />
</Cluster></span>

web.xml文件的修改很简单:只需要在<web-app/>节点中添加<distributable/>这个节点就可以了。</span> tomcat安全证书配置(/conf/server.xml <Service>标签中):

<span style="font-size:14px;"><Connector server="ligang" port="9443" minProcessors="5" maxProcessors="150" minSpareThreads="25" maxSpareThreads="75"
disableUploadTimeout="true" URIEncoding="utf-8" useBodyEncodingForURI="true" SSLEnabled="true"
clientAuth="false" keystoreFile="ligang.p12" keystorePass="ligang@)!@" keystoreType="PKCS12" sslProtocol="TLS"
enableLookups="true" connectionTimeout="20000" acceptCount="100" debug="0" scheme="https" secure="true" /></span>

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券