Search code examples
linuxehcacheaixmulticastdistributed-caching

Simple ehcache program to verify network settings for multicast


I'm looking for a simple ehcache program example to verify network settings for multicast. There are many postings about issues with configuring multicast for ehcache. I'd like a simple script/program that can start two java vms and verify that cache updates are communicated between the VMs, thus verifying that multicast configuration works on the single server, and an extension of the program that can work on multiple servers, verifying that ehcache is working between the servers.

Thanks,

Justin


Solution

  • JGroups have tools for checking IP multicast, see the manual on chapter 2. The McastReceiverTest and McastSenderTest are easy to use:

    start receiver on one machine

    java org.jgroups.tests.McastReceiverTest -mcast_addr 224.10.10.10 -port 5555
    

    and sender on another

    java org.jgroups.tests.McastSenderTest -mcast_addr 224.10.10.10 -port 5555
    

    (maybe add -jar jgroups-X.jar)

    The sender transmits messages from the shell to all receivers, e.g.:

    sender:

    Socket=0.0.0.0/0.0.0.0:55276, ttl=32, bind interface=0.0.0.0/0.0.0.0
    > foo
    > << Received response from XXX.XXX.XXX.XXX:5555: Hello from Bela
    

    receiver:

    Socket=0.0.0.0/0.0.0.0:5555, bind interface=0.0.0.0/0.0.0.0
    foo [sender=XXX.XXX.XXX.XXX:55276]