我在一台机器上测试集群和session复制是正常的,但是放到多台机器上就不行了,发现不了其他机器上的tomcat。 后来我用一个组播测试工具测过一次,我收不到组播源发出的信息。
还用过一段java代码测试,也不行。
这是那个java测试组播的代码。
我收不到组播的信息。 public class MultiCastTest {
public static void main(String[] args) throws Exception {
// join a Multicast group and send the group salutations
String msg = "Hello";
InetAddress group = InetAddress.getByName("224.0.0.8");
MulticastSocket s = new MulticastSocket(45564);
s.joinGroup(group);
DatagramPacket hi = new DatagramPacket(msg.getBytes(), msg.length(),
group, 6789);
System.out.println("sending...");
s.send(hi);
System.out.println("sent and wait for receive."); // get their responses!
byte[] buf = new byte[1000];
DatagramPacket recv = new DatagramPacket(buf, buf.length);
s.receive(recv);
System.out.println("received.");
System.out.println(new String(recv.getData(), 16, recv.getLength())); // OK, I'm done talking - leave the group...
s.leaveGroup(group);
} }
我看文档上说tomcat的集群是通过组播技术实现的,是不是路由器必须要支持IGMP协议才行?
我现在也不知道路由器是不是支持IGMP协议,有没有什么办法测试一下?
还用过一段java代码测试,也不行。
这是那个java测试组播的代码。
我收不到组播的信息。 public class MultiCastTest {
public static void main(String[] args) throws Exception {
// join a Multicast group and send the group salutations
String msg = "Hello";
InetAddress group = InetAddress.getByName("224.0.0.8");
MulticastSocket s = new MulticastSocket(45564);
s.joinGroup(group);
DatagramPacket hi = new DatagramPacket(msg.getBytes(), msg.length(),
group, 6789);
System.out.println("sending...");
s.send(hi);
System.out.println("sent and wait for receive."); // get their responses!
byte[] buf = new byte[1000];
DatagramPacket recv = new DatagramPacket(buf, buf.length);
s.receive(recv);
System.out.println("received.");
System.out.println(new String(recv.getData(), 16, recv.getLength())); // OK, I'm done talking - leave the group...
s.leaveGroup(group);
} }
我看文档上说tomcat的集群是通过组播技术实现的,是不是路由器必须要支持IGMP协议才行?
我现在也不知道路由器是不是支持IGMP协议,有没有什么办法测试一下?
session我是通过filter打印的,每次请求过来都会打印。
登陆后关闭打印登陆session的那个tomcat然后继续访问的话session就失效了,session没有复制过来。
因为tomcat启动后就没有发现其他的tomcat,通过控制台打印的信息可以看出来。