8 Replies Latest reply on Dec 6, 2016 8:57 AM by Dominique Claes

    Wildfly CLI - jgroups

    Dominique Claes Newbie

      Hello,

       

      I'm able to use Wildfly CLI to add a socket-binding for jgroups but I'm unable to add the default jgroups subsystem configuration as found in standalone-ha.xml by use of CLI.

      How can I add the following configuration by CLI:

       

      <subsystem xmlns="urn:jboss:domain:jgroups:4.0">
                  <channels default="ee">
                      <channel name="ee" stack="udp"/>
                  </channels>
                  <stacks>
                      <stack name="udp">
                          <transport type="UDP" socket-binding="jgroups-udp"/>
                          <protocol type="PING"/>
                          <protocol type="MERGE3"/>
                          <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
                          <protocol type="FD_ALL"/>
                          <protocol type="VERIFY_SUSPECT"/>
                          <protocol type="pbcast.NAKACK2"/>
                          <protocol type="UNICAST3"/>
                          <protocol type="pbcast.STABLE"/>
                          <protocol type="pbcast.GMS"/>
                          <protocol type="UFC"/>
                          <protocol type="MFC"/>
                          <protocol type="FRAG2"/>
                      </stack>
                      <stack name="tcp">
                          <transport type="TCP" socket-binding="jgroups-tcp"/>
                          <protocol type="MPING" socket-binding="jgroups-mping"/>
                          <protocol type="MERGE3"/>
                          <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
                          <protocol type="FD"/>
                          <protocol type="VERIFY_SUSPECT"/>
                          <protocol type="pbcast.NAKACK2"/>
                          <protocol type="UNICAST3"/>
                          <protocol type="pbcast.STABLE"/>
                          <protocol type="pbcast.GMS"/>
                          <protocol type="MFC"/>
                          <protocol type="FRAG2"/>
                      </stack>
                  </stacks>
              </subsystem>
      
        • 1. Re: Wildfly CLI - jgroups
          Paul Ferraro Master

          Something like this:

          batch
          /subsystem=jgroups:add(default-channel=ee)
          /subsystem=jgroups/channel=ee:add(stack=udp)
          /subsystem=jgroups/stack=udp:add()
          /subsystem=jgroups/stack=udp/transport=UDP:add(socket-binding=jgroups-udp)
          /subsystem=jgroups/stack=udp/protocol=PING:add()
          /subsystem=jgroups/stack=udp/protocol=MERGE3:add()
          /subsystem=jgroups/stack=udp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
          /subsystem=jgroups/stack=udp/protocol=FD_ALL:add()
          /subsystem=jgroups/stack=udp/protocol=VERIFY_SUSPECT:add()
          /subsystem=jgroups/stack=udp/protocol=pbcast.NAKACK2:add()
          /subsystem=jgroups/stack=udp/protocol=UNICAST3:add()
          /subsystem=jgroups/stack=udp/protocol=pbcast.STABLE:add()
          /subsystem=jgroups/stack=udp/protocol=pbcast.GMS:add()
          /subsystem=jgroups/stack=udp/protocol=UFC:add()
          /subsystem=jgroups/stack=udp/protocol=MFC:add()
          /subsystem=jgroups/stack=udp/protocol=FRAG2:add()
          /subsystem=jgroups/stack=tcp:add()
          /subsystem=jgroups/stack=tcp/transport=TCP:add(socket-binding=jgroups-tcp)
          /subsystem=jgroups/stack=tcp/protocol=MPING:add(socket-binding=jgroups-mping)
          /subsystem=jgroups/stack=tcp/protocol=MERGE3:add()
          /subsystem=jgroups/stack=tcp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
          /subsystem=jgroups/stack=tcp/protocol=FD:add()
          /subsystem=jgroups/stack=tcp/protocol=VERIFY_SUSPECT:add()
          /subsystem=jgroups/stack=tcp/protocol=pbcast.NAKACK2:add()
          /subsystem=jgroups/stack=tcp/protocol=UNICAST3:add()
          /subsystem=jgroups/stack=tcp/protocol=pbcast.STABLE:add()
          /subsystem=jgroups/stack=tcp/protocol=pbcast.GMS:add()
          /subsystem=jgroups/stack=tcp/protocol=MFC:add()
          /subsystem=jgroups/stack=tcp/protocol=FRAG2:add()
          run-batch
          
          • 2. Re: Wildfly CLI - jgroups
            Dominique Claes Newbie

            The following works: jboss-cli.sh --connect command="/subsystem=jgroups:add(default-channel=ee,default-stack=udp)"

             

            But the next command fails: .jboss-cli.sh --connect command="/subsystem=jgroups/channel=ee:add"

            Then I get the message:

             

            {

                "outcome" => "failed",

                "failure-description" => "WFLYCTL0216: Management resource '[

                (\"subsystem\" => \"jgroups\"),

                (\"stack\" => \"udp\")

            ]' not found",

                "rolled-back" => true

            }

             

            Even when I run it in batch, it fails

            • 3. Re: Wildfly CLI - jgroups
              Paul Ferraro Master

              dominique_claes My apologies - I was a little tired when I originally responded.  I've edited the above batch of commands for correctness.

               

              You *must* execute the above commands as a batch, otherwise they would need to be ordered carefully to prevent resources being referenced before they are defined.  Also, don't use default-stack, it is deprecated.

               

              The following equivalent set of commands will be runnable without a batch:

              /subsystem=jgroups:add()
              /subsystem=jgroups/stack=udp:add()
              /subsystem=jgroups/stack=udp/transport=UDP:add(socket-binding=jgroups-udp)
              /subsystem=jgroups/stack=udp/protocol=PING:add()
              /subsystem=jgroups/stack=udp/protocol=MERGE3:add()
              /subsystem=jgroups/stack=udp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
              /subsystem=jgroups/stack=udp/protocol=FD_ALL:add()
              /subsystem=jgroups/stack=udp/protocol=VERIFY_SUSPECT:add()
              /subsystem=jgroups/stack=udp/protocol=pbcast.NAKACK2:add()
              /subsystem=jgroups/stack=udp/protocol=UNICAST3:add()
              /subsystem=jgroups/stack=udp/protocol=pbcast.STABLE:add()
              /subsystem=jgroups/stack=udp/protocol=pbcast.GMS:add()
              /subsystem=jgroups/stack=udp/protocol=UFC:add()
              /subsystem=jgroups/stack=udp/protocol=MFC:add()
              /subsystem=jgroups/stack=udp/protocol=FRAG2:add()
              /subsystem=jgroups/stack=tcp:add()
              /subsystem=jgroups/stack=tcp/transport=TCP:add(socket-binding=jgroups-tcp)
              /subsystem=jgroups/stack=tcp/protocol=MPING:add(socket-binding=jgroups-mping)
              /subsystem=jgroups/stack=tcp/protocol=MERGE3:add()
              /subsystem=jgroups/stack=tcp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
              /subsystem=jgroups/stack=tcp/protocol=FD:add()
              /subsystem=jgroups/stack=tcp/protocol=VERIFY_SUSPECT:add()
              /subsystem=jgroups/stack=tcp/protocol=pbcast.NAKACK2:add()
              /subsystem=jgroups/stack=tcp/protocol=UNICAST3:add()
              /subsystem=jgroups/stack=tcp/protocol=pbcast.STABLE:add()
              /subsystem=jgroups/stack=tcp/protocol=pbcast.GMS:add()
              /subsystem=jgroups/stack=tcp/protocol=MFC:add()
              /subsystem=jgroups/stack=tcp/protocol=FRAG2:add()
              /subsystem=jgroups/channel=ee:add(stack=udp)
              /subsystem=jgroups:write-attribute(name=default-channel, value=ee)
              
              • 4. Re: Wildfly CLI - jgroups
                Dominique Claes Newbie

                Sadly it fails. When I implement the commands from above, I get the following message:

                 

                {

                    "outcome" => "failed",

                    "failure-description" => "WFLYCLJG0010: Transport for stack udp is not defined. Please specify both a transport and protocol list, either as optional parameters to add() or via batching.",

                    "rolled-back" => true,

                    "response-headers" => {"process-state" => "reload-required"}

                }

                 

                I believe it fails with command: "/subsystem=jgroups/stack=udp:add()"

                • 5. Re: Wildfly CLI - jgroups
                  Paul Ferraro Master

                  dominique_claes The batch-less commands I posted will only work in admin-only mode.  If you are trying to run these commands against a runtime server, then you need to batch them.

                  • 6. Re: Wildfly CLI - jgroups
                    Dominique Claes Newbie

                    Hi Paul,

                     

                    Still no result. It still gives the error from the previous post.

                    • 7. Re: Wildfly CLI - jgroups
                      Paul Ferraro Master

                      Are you certain that you are batching them correctly?

                      Here is my output:

                      [standalone@embedded /] batch
                      [standalone@embedded / #] /subsystem=jgroups:add(default-channel=ee)
                      [standalone@embedded / #] /subsystem=jgroups/channel=ee:add(stack=udp)
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/transport=UDP:add(socket-binding=jgroups-udp)
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=PING:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=MERGE3:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=FD_ALL:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=VERIFY_SUSPECT:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=pbcast.NAKACK2:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=UNICAST3:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=pbcast.STABLE:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=pbcast.GMS:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=UFC:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=MFC:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=udp/protocol=FRAG2:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/transport=TCP:add(socket-binding=jgroups-tcp)
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=MPING:add(socket-binding=jgroups-mping)
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=MERGE3:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=FD_SOCK:add(socket-binding=jgroups-udp-fd)
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=FD:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=VERIFY_SUSPECT:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=pbcast.NAKACK2:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=UNICAST3:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=pbcast.STABLE:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=pbcast.GMS:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=MFC:add()
                      [standalone@embedded / #] /subsystem=jgroups/stack=tcp/protocol=FRAG2:add()
                      [standalone@embedded / #] run-batch 
                      06:49:54,166 INFO  [org.jboss.as.clustering.jgroups] (AeshProcess: 34) WFLYCLJG0001: Activating JGroups subsystem.
                      The batch executed successfully
                      process-state: reload-required 
                      
                      • 8. Re: Wildfly CLI - jgroups
                        Dominique Claes Newbie

                        When I create a separate file with all the commands in batch and I execute that script in 'embed-server' mode than it works.

                        It was like you suggested that I needed to run this while Wildfly is not running.