Version 5

    Using probe.sh/bat to ping members of a cluster

     

    Every JGroups node listens to special 4 byte DIAG multicast messages, and replies with information about its state, e.g. the JGroups version use, its address and the current membership.

    JGroups has a probe.sh/bat script in its ./bin directory, which will be integrated into JBoss soon, but probe can be invoked directly as follows:

    • Add jgroups-all.jar, concurrent.jar, commons-logging and log4j.jar to the CLASSPATH

    • Invoke probe:

       
      bela@laptop /cygdrive/c
      $ java org.jgroups.tests.Probe -help
      Probe [-help] [-addr <addr>] [-bind_addr <addr>] [-port <port>] [-ttl <ttl>] [-t
      imeout <timeout>]
      

       

     

    The options are as follows:

    • -addr: the multicast address, e.g. 228.1.2.3

    • -bind_addr: for multihomed hosts, the address of the interface to bind to, e.g. 192.168.5.1

    • -port: the multicast port of the group to which to send multicasts, e.g. 45566

    • -ttl: the time-to-live (in hops): the greater the more hosts will you reach

    • -timeout: how long to wait (in seconds)

     

    Probe multicasts a DIAG packet and wait for responses until the timeout has elapsed, example (with 3 JGroups Draw instances running):

    bela@laptop /cygdrive/c
    $ java org.jgroups.tests.Probe -addr 226.6.6.6 -port 12345 -bind_addr 192.168.0
    .2 -ttl 8 -timeout 5
    
    -- send probe on /226.6.6.6:12345
    
    
    #1: 192.168.0.2:1081 (DrawGroupDemo) [226.6.6.6:12345]
    Version=2.2.8, cvs="$Id: Version.java,v 1.18.2.1 2005/05/30 09:47:56 belaban Exp
     $"
    bound to /192.168.0.2:0
    members: [192.168.0.2:1081, 192.168.0.2:1088, 192.168.0.2:1107]
    
    
    #2: 192.168.0.2:1107 (DrawGroupDemo) [226.6.6.6:12345]
    Version=2.2.8, cvs="$Id: Version.java,v 1.18.2.1 2005/05/30 09:47:56 belaban Exp
     $"
    bound to /192.168.0.2:0
    members: [192.168.0.2:1081, 192.168.0.2:1088, 192.168.0.2:1107]
    
    
    #3: 192.168.0.2:1088 (DrawGroupDemo) [226.6.6.6:12345]
    Version=2.2.8, cvs="$Id: Version.java,v 1.18.2.1 2005/05/30 09:47:56 belaban Exp
     $"
    bound to /192.168.0.2:0
    members: [192.168.0.2:1081, 192.168.0.2:1088, 192.168.0.2:1107]
    
    

     

     

    In the example, 3 members responsed. The first response is from the member listening on port 1081 of 192.168.0.2, the second from 11107, the third from 1088. Every member is running JGroups version 2.2.8, has joined multicast group 226.6.6.6 at port 12345 and has a membership of

    192.168.0.2:1081, 192.168.0.2:1088, 192.168.0.2:1107

    .