简体   繁体   English

mod_jk负载均衡器后面的双Tomcat

[英]Double Tomcat behind mod_jk load balancer

I am in the process of setting up two Tomcat instances on the same server with an Apache mod_jk load balancer in front of it. 我正在使用同一台服务器上的Apache mod_jk负载均衡器在其上设置两个Tomcat实例的过程。 I have been using a guide and the Apache Tomcat documentation and stuck to the basic setup suggested. 我一直在使用指南和Apache Tomcat文档,并坚持建议的基本设置。 When i try to start up any of the Tomcat instances, i get a BindException from when it tries to start up the SimpleTcpCluster. 当我尝试启动任何Tomcat实例时,从尝试启动SimpleTcpCluster时会收到BindException。 The error message is "Cannot assign requested address". 错误消息是“无法分配请求的地址”。

I googled for solutions to this issue and came across two suggestions, the first one being to ensure that Java is configured to prefer IPv4 addresses. 我用谷歌搜索了此问题的解决方案,并遇到了两个建议,第一个建议是确保将Java配置为首选IPv4地址。 Tried it - no change. 试过了-没有变化。 The second suggested to replace the auto value on the address parameter on the Receiver component inside the cluster config (see config below). 第二个建议在群集配置内部的接收器组件上替换地址参数上的自动值(请参阅下面的配置)。

      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
    <Manager className="org.apache.catalina.ha.session.DeltaManager"
      expireSessionsOnShutdown="false"
      notifyListenersOnReplication="true"/>
    <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="3000"/>
      <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
        <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
      </Sender>
      <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="localhost" port="4000" autoBind="100"
        selectorTimeout="5000" maxThreads="6"/>
      <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"/>
    <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
    <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
  </Cluster>

I tried changing "auto" to "localhost", which led to a different error message on Tomcat startup, saying "Address already in use :8009". 我尝试将“自动”更改为“本地主机”,这导致Tomcat启动时出现另一条错误消息,提示“地址已在使用中:8009”。

At this point i really don't know where to look. 在这一点上,我真的不知道在哪里看。 Is localhost a bad value? localhost是一个错误的值吗? Should i be using auto but make a change somewhere else? 我应该使用自动但要在其他地方进行更改吗? Is there anyone out there with a little more experience on this that can give me a helping hand? 是否有人在这方面有更多的经验可以帮助我?

We got around this issue by changing the address parameter in the Receiver tag inside the Cluster configuration from "auto" to the actual IP address of the server. 通过将群集配置内Receiver标记中的address参数从“ auto”更改为服务器的实际IP地址,我们解决了这个问题。 I was never able to figure out why this was not working and didn't want to spend any more time once we got the calls through. 我永远无法弄清楚为什么这种方法不起作用,并且一旦我们打通电话,就不想再花费更多的时间。

   <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="123.123.x.x" port="4000" autoBind="100"
        selectorTimeout="5000" maxThreads="6"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM