13.2.13. Configure the JGroups Subsystem to Use TCP

The mod_cluster subsystem relies upon the JGroups subsystem to manage and track nodes leaving, joining, and failing over in the cluster. By default, the JGroups subsystem communicates using multicast UDP. Use the following procedure to configure the JGroups subsystem to use unicast TCP instead.
To configure the mod_cluster subsystem to use TCP as well, refer to Section 13.2.14, “Configure the mod_cluster Subsystem to Use TCP”.
  1. Run the Management CLI.

    Launch the Management CLI, using the EAP_HOME/bin/jboss-cli.sh command in Linux or the EAP_HOME\bin\jboss-cli.bat command in Microsoft Windows Server. Type connect to connect to the domain controller on the localhost, or connect IP_ADDRESS to connect to a domain controller on a remote server.
  2. Modify the following script to suit your environment.

    Copy the following script into a text editor. If you use a different profile on a managed domain, change the profile name. If you use a standalone server, remove the /profile=full-ha portion of the commands. Modify the properties listed at the bottom of the command as follows. Each of these properties is optional.
    initial_hosts
    A comma-separated list of the hosts which are considered well-known, and will be available to look up the initial membership.
    port_range
    If desired, you can assign a port range. If you assign a port range of 2, and the initial port is 7600, then TCPPING will attempt to contact each host on ports 7600-7601. This property is optional.
    timeout
    An optional timeout value, in milliseconds, for cluster members.
    num_initial_members
    The number of nodes before the cluster is considered to be complete. This property is optional.
    cd /profile=full-ha/subsystem=jgroups
    ./stack=tcpping:add
    cd stack=tcpping
    ./transport=TRANSPORT:add(type=TCP,socket-binding=jgroups-tcp)
    :add-protocol(type=TCPPING)
    :add-protocol(type=MERGE2)
    :add-protocol(type=FD_SOCK,socket-binding=jgroups-tcp-fd)
    :add-protocol(type=FD)
    :add-protocol(type=VERIFY_SUSPECT)
    :add-protocol(type=BARRIER)
    :add-protocol(type=pbcast.NAKACK)
    :add-protocol(type=UNICAST2)
    :add-protocol(type=pbcast.STABLE)
    :add-protocol(type=pbcast.GMS)
    :add-protocol(type=UFC)
    :add-protocol(type=MFC)
    :add-protocol(type=FRAG2)
    :add-protocol(type=RSVP)
    cd protocol=TCPPING
    ./property=initial_hosts/:add(value="HostA[7600],HostB[7600]")
    ./property=port_range/:add(value=0)
    ./property=timeout/:add(value=3000)
    ./property=num_initial_members/:add(value=3) 
    cd ../..
    :write-attribute(name=default-stack,value=tcpping)
    
  3. Run the script in batch mode.

    Warning

    The servers runnning the profile have to be shutdown before executing the batch file.
    At the Management CLI prompt, type batch and press the Enter key. The prompt changes to include a hash (#) symbol to indicate that you are in batch mode. This allows you to enter a series of commands. If any one of them fails, the entire operation will be rolled back.
    Paste the modified script from the previous step, adding an extra newline at the end. Type run-batch to run the batch. After all commands have run, the message The batch executed successfully appears.
Result

The TCPPING stack is now available to the JGroups subsystem. If it is used, the JGroups subsystem uses TCP for all network communication. To configure the mod_cluster subsystem to use TCP as well, refer to Section 13.2.14, “Configure the mod_cluster Subsystem to Use TCP”.