作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在我的虚拟机所连接的多个网络之一上对 Tomcat 实例进行集群。使用默认配置,我在我感兴趣的网络上看不到任何多播流量。
因此,我尝试使用 McastService
中的 bind
属性来告诉 Tomcat 使用哪个网络接口(interface)。
当我使用 IPv4 或 IPv6 bind
网络接口(interface)地址时,我看到 3 个数据包通过正确的多播地址/端口,但随后 Tomcat 抛出异常:
Feb 15, 2014 8:22:45 PM org.apache.catalina.ha.tcp.SimpleTcpCluster startInternal
SEVERE: Unable to start cluster.
org.apache.catalina.tribes.ChannelException: java.io.IOException: Invalid argument; No faulty members identified.
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:178)
at org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:99)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:157)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:419)
at org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:685)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1106)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Caused by: java.io.IOException: Invalid argument
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:676)
at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:503)
at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:480)
at org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServiceImpl.java:269)
at org.apache.catalina.tribes.membership.McastService.start(McastService.java:386)
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:167)
... 22 more
我知道多播正在工作并已启用,因为我能够使用 tcpdump
查看数据包并使用 mcsender
发送数据包。我尝试禁用 IPv6,但没有帮助。
如何将 Tomcat 连接到正确的网络接口(interface)以进行集群。我需要将它连接到:
eth2 Link encap:Ethernet HWaddr bc:76:4e:05:5b:22
inet addr:192.168.3.4 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::be76:4eff:fe05:5b22/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:70 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4160 (4.1 KB) TX bytes:648 (648.0 B)
运行 Tomcat 7.0.42。我一直在尝试使用的配置(主要是默认 + bind
)是:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="main4">
<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"
bind="192.168.3.4"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4000"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
<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"/>
<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
最佳答案
删除下面一行:
bind="192.168.3.4"
关于tomcat - Tomcat集群如何使用McastService bind?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21803671/
我是一名优秀的程序员,十分优秀!