1 Reply Latest reply on Aug 23, 2016 6:01 AM by omarbennis

    I can not get session replication to work with wildfly 10.

    omarbennis

      We have put httpd as a load balancer in front wildfly. I am using wildfly 10.1.0.


      I have 3 machines, one master and two slaves.


      In my domain.xml of the master I have:


       

                  <subsystem xmlns="urn:jboss:domain:modcluster:2.0">

                      <mod-cluster-config proxies="mc-prox1" connector="ajp">

                          <dynamic-load-provider>

                              <load-metric type="busyness"/>

                          </dynamic-load-provider>

                      </mod-cluster-config>

                  </subsystem>

       

          <socket-binding-groups>

              <socket-binding-group name="full-ha-sockets" default-interface="public">

                  <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>

                  <socket-binding name="http" port="${jboss.http.port:8080}"/>

                  <socket-binding name="https" port="${jboss.https.port:8443}"/>

                  <socket-binding name="iiop" interface="unsecure" port="3528"/>

                  <socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>

                  <socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>

                  <socket-binding name="jgroups-tcp" interface="private" port="7600"/>

                  <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>

                  <socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>

                  <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>

                  <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>

                  <socket-binding name="txn-recovery-environment" port="4712"/>

                  <socket-binding name="txn-status-manager" port="4713"/>

             

                  <outbound-socket-binding name="mail-smtp">

                      <remote-destination host="localhost" port="25"/>

                  </outbound-socket-binding>

                  <outbound-socket-binding name="mc-prox1">

                      <remote-destination host="192.168.2.201" port="8796"/>

                  </outbound-socket-binding>

       

       

              </socket-binding-group>

          </socket-binding-groups>

      <server-groups>

              <server-group name="mycluster" profile="full-ha">

                  <socket-binding-group ref="full-ha-sockets"/>

                  <deployments>

                      <deployment name="PATT_EAR.ear" runtime-name="PATT_EAR.ear"/>

                  </deployments>

              </server-group>

          </server-groups>

       

      In my hosts.xml for slave 1 I have:

       

          <servers>

              <server name="server-web1" group="mycluster" auto-start="true">

                  <jvm name="jvm-web1">

                      <heap size="1024m" max-size="3072m"/>

                      <permgen size="1024m" max-size="1024m"/>

                      <jvm-options>

                          <option value="-server"/>

                          <option value="-d64"/>

                      </jvm-options>

                  </jvm>

              </server>

          </servers>

       

      In my hosts.xml for slave 2 I have:


          <server name="server-web2" group="mycluster" auto-start="true">

                  <jvm name="jvm-web2">

                      <heap size="1024m" max-size="3072m"/>

                      <permgen size="1024m" max-size="1024m"/>

                      <jvm-options>

                          <option value="-server"/>

                          <option value="-d64"/>

                      </jvm-options>

                  </jvm>

              </server>

          </servers>

       

      All the servers start fine and in the logs I have:

       

      The logs for the master

      2016-08-18 09:38:06,884 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web1

      2016-08-18 09:38:06,891 WARN  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:06,987 WARN  [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:09,538 INFO  [org.jboss.as.host.controller] (management task-4) WFLYHC0021: Server [Server:server-web1] connected using connection [Channel ID 622b12f8 (inbound) of Remoting connection 124392b0 to /192.168.2.201:42232 of endpoint "master:MANAGEMENT" <67c473e1>]

      2016-08-18 09:38:09,633 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web2

      2016-08-18 09:38:09,634 WARN  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:09,685 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web1

      2016-08-18 09:38:09,753 WARN  [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:16,741 INFO  [org.jboss.as.domain.controller] (Host Controller Service Threads - 34) WFLYHC0019: Registered remote slave host "hostweb2", JBoss WildFly Full 10.1.0.CR1 (WildFly 2.2.0.CR9)

      2016-08-18 09:38:19,254 INFO  [org.jboss.as.domain.controller] (Host Controller Service Threads - 36) WFLYHC0019: Registered remote slave host "hostweb1", JBoss WildFly Full 10.1.0.CR1 (WildFly 2.2.0.CR9)

      2016-08-18 09:38:20,150 INFO  [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:server-web2] connected using connection [Channel ID 05201088 (inbound) of Remoting connection 0d2653a3 to /192.168.2.201:55390 of endpoint "master:MANAGEMENT" <67c473e1>]

      2016-08-18 09:38:20,248 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web2

      2016-08-18 09:38:20,252 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://192.168.2.201:9990/management

      2016-08-18 09:38:20,254 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://192.168.2.201:9990

      2016-08-18 09:38:20,255 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 17840ms - Started 55 of 57 services (19 services are lazy, passive or on-demand)

       

      The logs for the slaves show

      2016-08-18 09:38:15,752 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) WFLYRMT0001: Listening on 192.168.2.202:9999

      2016-08-18 09:38:19,273 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0148: Connected to master host controller at remote://192.168.2.201:9999

      2016-08-18 09:38:19,364 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web1

      2016-08-18 09:38:19,366 WARN  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:19,474 WARN  [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1

      2016-08-18 09:38:21,912 INFO  [org.jboss.as.host.controller] (management task-10) WFLYHC0021: Server [Server:server-web1] connected using connection [Channel ID 45e867e4 (inbound) of Remoting connection 565bb1dc to /192.168.2.202:56530 of endpoint "hostweb1:MANAGEMENT" <60a9371d>]

      2016-08-18 09:38:22,005 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 8419ms - Started 46 of 50 services (18 services are lazy, passive or on-demand)

      2016-08-18 09:38:22,034 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web1

       

      016-08-18 09:38:13,269 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) WFLYRMT0001: Listening on 192.168.2.203:9999

      2016-08-18 09:38:16,763 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0148: Connected to master host controller at remote://192.168.2.201:9999

      2016-08-18 09:38:16,847 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web2

      2016-08-18 09:38:16,850 WARN  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web2

      2016-08-18 09:38:16,950 WARN  [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web2

      2016-08-18 09:38:19,968 INFO  [org.jboss.as.host.controller] (management task-10) WFLYHC0021: Server [Server:server-web2] connected using connection [Channel ID 434a7830 (inbound) of Remoting connection 114a8665 to /192.168.2.203:60987 of endpoint "hostweb2:MANAGEMENT" <29b1c4e8>]

      2016-08-18 09:38:20,052 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 8883ms - Started 46 of 50 services (18 services are lazy, passive or on-demand)

      2016-08-18 09:38:20,083 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web2

       

      In the configuration file of httpd, I have:


      ##Creation du load balancer

       

      CreateBalancers 1

       

      <IfModule manager_module>

          Listen PIXID-LBWEB:8796

          ManagerBalancerName mycluster

       

          <VirtualHost PIXID-LBWEB:8796>

              KeepAliveTimeout 900

              MaxKeepAliveRequests 0

              AdvertiseFrequency 5

              ServerAdvertise off

        EnableMCPMReceive

       

              <Location />

                  Order deny,allow

                 Deny from all

           Allow from 192.168.2.202 192.168.2.203 192.168.2.204

              </Location>

       

        <Location /mod_cluster_manager>

              SetHandler mod_cluster-manager

              Order deny,allow

              Allow from all

        </Location>

       

           </VirtualHost>

      </IfModule>

       

      Listen 8080

      ServerName PIXID-LBWEB:8080

       

      NameVirtualHost PIXID-LBWEB:8080

      <VirtualHost PIXID-LBWEB:8080>

          ServerAdmin exploitation@abc.com

          ServerName PIXID-LBWEB:8080

       

          ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=off timeout=10

          ProxyPassReverse / balancer://mycluster

          ProxyPreserveHost On

       

          ErrorLog "|/appli/apache2/bin/rotatelogs /log/apache/error_log_balancer.%Y-%m-%d 86400"

          CustomLog "|/appli/apache2/bin/rotatelogs /log/apache/access_log_balancer.%Y-%m-%d 86400" common

       

          <Location />

              Order deny,allow

              Allow from All

          </Location>

       

      </VirtualHost>

       

      The problem that I have is that the session does not replicate between the two servers. Load balacing works with no problems.

      If I stop the slave 1, I get switched to slave 2 but the session is not there and the second server creates a new session id for me.

       

      I did add <distributable/> to my web.xml.

       

      Am I missing something in the configuration?

       

      Thanks for your help.

        • 1. Re: I can not get session replication to work with wildfly 10.
          omarbennis

          The problem was with


           

          <socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
            <socket-binding name="jgroups-tcp" interface="private" port="7600"/>
            <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
            <socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
            <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>

           


          I had to remove interface="private" for it to work.

          The new configuration now is

           

          <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.201}" multicast-port="45700"/>
            <socket-binding name="jgroups-tcp" port="7600"/>
            <socket-binding name="jgroups-tcp-fd" port="57600"/>
            <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.201}" multicast-port="45688"/>
            <socket-binding name="jgroups-udp-fd" port="54200"/>