6 Replies Latest reply on Nov 24, 2011 5:11 PM by João Subtil

    mod_cluster and HTTPD virtual hosts (again...)

    João Subtil Newbie

      Ok,

       

      I've setup three different JBoss Clusters: cluster1, cluster2 and cluster3.

       

      And on apache httpd I've created three different virtual named sites.

       

      On each virtual site I added the proxypass / balancer://cluster1 for virtual site cluster1, proxypass / balancer://cluster2 for virtual site cluster2, and so on for site 3.

       

      My question is the following:

       

      First I needed to add the CreateBalancers 0 directive to the virtual site of mod_cluster, so that the proxypass directive could work.

       

      Second, any virtual site has all applications of every cluster...

       

      In another words, I have app1 deployed on cluster1 and I can acess it on virtual site for cluster1 but also in cluster2 and cluster3...

       

      Shouldn't app1 be only available on cluster1?

        • 1. Re: mod_cluster and HTTPD virtual hosts (again...)
          Jean-Frederic Clere Master

          In fact the mod_cluster mapping won't interact well with the proxy in this case: it will process the request before the proxypass and route the request according its information Alias and Context. (Use UseAlias directive).

          1 of 1 people found this helpful
          • 2. Re: mod_cluster and HTTPD virtual hosts (again...)
            João Subtil Newbie

            Ok, so what this means is that before virtual sites and/or proxypass directives are processed, mod_cluster has already defined the destination nodes for the request, hence all deployed applications in any JBoss cluster will appear in all virtual sites. Is this correct?

             

            If so, how can I do isolation ?

            • 3. Re: mod_cluster and HTTPD virtual hosts (again...)
              Jean-Frederic Clere Master

              Use the Alias in the Host and UseAlias directive to get mod_cluster doing the whole routing.

              • 4. Re: mod_cluster and HTTPD virtual hosts (again...)
                João Subtil Newbie

                Ok, thank you.

                 

                It does work, setting the name in server.xml of jbossweb.sar to coincide to the DNS name and the Apache virtual site, and using the directive UseAlias 1, does the trick.

                 

                Requests to dns name cluster1 go to the Apache Virtual site cluster1 and are only delivered to the members of Jboss cluster1 by using those configuration and directives.

                 

                But there are at least two issues to this configuration...

                 

                1st) The excluded contexts like web-console, juddi, and so on are available now on the Apache mod-cluster frontend, while previously they weren't.

                       I've tried several settings on mod_cluster xml file on the exclude contexts, like cluster1:web-console, cluster1:admin-console, but it doesn't work. It seems this is a bug that will be solved on 1.1.4 release?

                 

                2nd) It seems that no stick session is done by mod_cluster... it just load balances between nodes even after setting up a session and setting the JSESSIONID cookie value.

                One thing strange was that previously the cookie had at the end the JVM route like yTN2Dakg_.Route1 and now it has nothing, it's just like yTN2Dakg__.

                 

                Previously after creating a session, it would stick at the same node. My ProxyPass directive is the same and it is:

                ProxyPass / balancer://cluster1/ stickysession=JSESSIONID|jsessionid nofailover=On

                • 5. Re: mod_cluster and HTTPD virtual hosts (again...)
                  João Subtil Newbie

                  Resolution for the 1st issue can be done by adding the following to the apache virtual host configuration:

                   

                  ProxyPassMatch /admin-console !

                  ProxyPassMatch /web-console !

                  ProxyPassMatch /juddi !

                   

                  And so on...

                   

                  Now the 2nd issue still happens, no sticky sessions even with jvmRoute defined, and without any ProxyPass directive...

                  • 6. Re: mod_cluster and HTTPD virtual hosts (again...)
                    João Subtil Newbie

                    Well it seems that you need to define the jvmRoute in two ways:

                     

                    -Djboss.jvmRoute  as to allow sticky sessions

                    -Djboss.mod_cluster.jvmRoute to the same value as above but only to show a human readable name on the mode-cluster-manager page. I don't think it does anything else.

                     

                    With -Djboss.jvmRoute defined, sticky sessions do work with virtual hostnames.