2 Replies Latest reply on Feb 19, 2019 3:58 PM by ievgenii24

    How to control Wildfly Undertow load balancer

    ievgenii24

      Hi,

       

      does anybody know how can i control wildfly undertow loadbalancer?

       

      Here is my load balancer configuration:

       

                  <subsystem xmlns="urn:jboss:domain:undertow:4.0" instance-id="balancerNode">

                      <buffer-cache name="default"/>

                      <server name="default-server">

                          <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>

                          <https-listener name="https" socket-binding="https" secure="true" security-realm="ssl-security-realm" enabled-protocols="TLSv1.2" enable-http2="true"/>

                          <http-listener name="management" socket-binding="mcmp-management" enable-http2="true"/>                  

                          <host name="default-host" alias="localhost">

                              <filter-ref name="load-balancer"/>

                          </host>

                      </server>

                      <servlet-container name="default"/>

                      <filters>

                          <mod-cluster name="load-balancer" management-socket-binding="mcmp-management" advertise-socket-binding="modcluster" enable-http2="true" max-retries="3" security-key="lbtestapp"/>

                      </filters>

                  </subsystem>

       

      I'm using domain cluster configuration, and it seems it works, as i can see from jboss domain.log that nodes registered and unregistered..

       

      With CLI command i can get only to:

      ls /profile=balancer-profile/subsystem=undertow/configuration=filter/mod-cluster=load-balancer/balancer  - but it shows nothing

       

      Commands like:

      ls /profile=balancer-profile/subsystem=undertow/configuration=filter/mod-cluster=load-balancer/balancer=mycluster/node=masterOne - does not work (it can't find resource with "mycluster" name)

       

      How can i give the name for my undertow load balancer?

      And how can i remove/disable nodes from load balancer?

       

      Also i did setup security-key="lbtestapp" on load balancer node and on slave node, but load balancer registers nodes which does not have security-key configured (i've tryed to change advertise-socket - no success, it still picking up not needed nodes..)

       

      Is there any help which describe what i can do with "/profile=balancer-profile/subsystem=undertow/configuration=filter/mod-cluster=load-balancer/balancer" object?

       

      Thanks.

        • 1. Re: How to control Wildfly Undertow load balancer
          rhusar

          Please see the following command and a sample output of the command. Note that these are runtime resources, thus you need to operate on the running resources e.g. starting with /host=master/server=load-balancer rather than the profile configuration at e.g. /profile=balancer-profile.

           

          The balancer name is whatever you have configured in your mod_cluster backend worker subsystem.

           

          [domain@localhost:9990 /] /host=master/server=load-balancer/subsystem=undertow/configuration=filter/mod-cluster=modcluster/balancer=mycluster:read-resource(recursive=true,include-runtime=true
          {
              "outcome" => "success",
              "result" => {
                  "max-attempts" => 1,
                  "sticky-session" => true,
                  "sticky-session-cookie" => "JSESSIONID",
                  "sticky-session-force" => false,
                  "sticky-session-path" => undefined,
                  "sticky-session-remove" => false,
                  "wait-worker" => 0,
                  "load-balancing-group" => undefined,
                  "node" => {
                      "backend2" => {
                          "aliases" => [
                              "default-host",
                              "192.168.1.2"
                          ],
                          "cache-connections" => 40,
                          "elected" => 0,
                          "flush-packets" => false,
                          "load" => 83,
                          "load-balancing-group" => undefined,
                          "max-connections" => 40,
                          "open-connections" => 6,
                          "ping" => 10,
                          "queue-new-requests" => true,
                          "read" => 0L,
                          "request-queue-size" => 1000,
                          "status" => "NODE_UP",
                          "timeout" => 0,
                          "ttl" => 60L,
                          "uri" => "ajp://127.0.0.1:8209/?#",
                          "written" => 0L,
                          "context" => {
                              "/" => {
                                  "requests" => 0,
                                  "status" => "enabled"
                              },
                              "/wildfly-services" => {
                                  "requests" => 0,
                                  "status" => "enabled"
                              }
                          }
                      },
                      "backend1" => {
                          "aliases" => [
                              "default-host",
                              "192.168.1.2"
                          ],
                          "cache-connections" => 40,
                          "elected" => 0,
                          "flush-packets" => false,
                          "load" => 83,
                          "load-balancing-group" => undefined,
                          "max-connections" => 40,
                          "open-connections" => 6,
                          "ping" => 10,
                          "queue-new-requests" => true,
                          "read" => 0L,
                          "request-queue-size" => 1000,
                          "status" => "NODE_UP",
                          "timeout" => 0,
                          "ttl" => 60L,
                          "uri" => "ajp://127.0.0.1:8109/?#",
                          "written" => 0L,
                          "context" => {
                              "/" => {
                                  "requests" => 0,
                                  "status" => "enabled"
                              },
                              "/wildfly-services" => {
                                  "requests" => 0,
                                  "status" => "enabled"
                              }
                          }
                      }
                  }
              }
          }
          1 of 1 people found this helpful
          • 2. Re: How to control Wildfly Undertow load balancer
            ievgenii24

            Thanks a lot! It works!

             

            Maybe you also know why Undertow load balancer can pick up wrong nodes? (I did try to setup security-key and change advertise IP address, but nothing helped)

            The only way i was able to filter out not needed nodes is to add filter like this:

             

            <expression-filter name="ip-access-filter" expression="ip-access-control(default-allow=false, acl={'xxx.xx.xxx.xx allow', 'xxx.xxx.xxx.xxx allow'})" />