6 Replies Latest reply on Apr 27, 2014 3:11 PM by rbe1733

    How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)

    rbe1733 Newbie

      Hi,

       

      I'm looking for a way to make virtual servers work in JBoss EAP 6.2.

      My goal is to isolate the deployed applications among multiple virtual hosts in Apache 2.2.

      I read a lot of documentation and went through different forums, but i can't succeed in making mod_cluster work for this configuration.

       

      I'm using domain mode with the following architecture :

      VM1 : Apache + JBoss domain controller (no server group) : 192.168.100.200->202

      VM2 : JBoss domain slave1 (2 server groups cluster1 and cluster2, host cluster11 (.211) in group cluster1, host cluster21 (.212), profile full-ha) : 192.168.100.210->212

      VM3 : JBoss domain slave2 (2 server groups cluster1 and cluster2, host cluster12 (.221) in group cluster1, host cluster22 (.222), profile full-ha)) : 192.168.100.220->222

       

      So, 2 clusters (cluster1 and cluster2) with 2 hosts for each of them.

      The .200, .201 and .202 addresses are reserved for Apache virtual hosts.

       

      What i would want Apache to do :

      .200 : mod_cluster-manager (accessible only through http://xxx-jboss-master.vmdomain.org/mod_cluster-manager)

      .201 : cluster-demo (accessible only through URL http://xxx-jboss-domain1.vmdomain.org/cluster-demo)

      .202 : jboss-helloworld (accessible only through http://xxx-jboss-domain2.vmdomain.org/jboss-helloworld)

       

      I use mod_cluster 1.2.6.

       

      Here is the content of /etc/httpd/conf.d/jboss_cluster.conf

       

      Listen 192.168.100.200:10001

      Listen 192.168.100.201:10001

      Listen 192.168.100.202:10001

       

      CreateBalancers 0

      UseAlias 1

      ProxyPreserveHost On

       

      <VirtualHost 192.168.100.200:10001>

        ServerName xxx-jboss-master.vmdomain.org

        <Directory />

          Order deny,allow

          Allow from all

        </Directory>

       

        <Location /mod_cluster-manager>

         SetHandler mod_cluster-manager

         Order deny,allow

         Allow from all

        </Location>

       

        KeepAliveTimeout 60

        MaxKeepAliveRequests 0

       

        AdvertiseFrequency 5

        EnableMCPMReceive

        ServerAdvertise on

      </VirtualHost>

       

      # domain1

      <VirtualHost 192.168.100.201:10001>

        ServerName xxx-jboss-domain1.vmdomain.org

        <Directory />

          Order deny,allow

          Allow from all

        </Directory>

       

        ErrorLog logs/xxx-jboss-domain1_error_log

        LogLevel debug

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

        LogFormat "%h %l %u %t \"%r\" %>s %b" common

        LogFormat "%{Referer}i -> %U" referer

        LogFormat "%{User-agent}i" agent

        CustomLog logs/xxx-jboss-domain1_access_log combined

       

        KeepAliveTimeout 60

        MaxKeepAliveRequests 0

      </VirtualHost>

       

      # domain2

      <VirtualHost 192.168.100.202:10001>

        ServerName xxx-jboss-domain2.vmdomain.org

        <Directory />

          Order deny,allow

          Allow from all

        </Directory>

       

        ErrorLog logs/xxx-jboss-domain2_error_log

        LogLevel debug

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

        LogFormat "%h %l %u %t \"%r\" %>s %b" common

        LogFormat "%{Referer}i -> %U" referer

        LogFormat "%{User-agent}i" agent

        CustomLog logs/xxx-jboss-domain2_access_log combined

       

        KeepAliveTimeout 60

        MaxKeepAliveRequests 0

      </VirtualHost>

       

      Here is the extract of domain.xml file :

      <subsystem xmlns="urn:jboss:domain:web:1.5" native="false">

                      <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                      <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>

                      <virtual-server name="master-host" default-web-module="mod_cluster-manager">

                          <alias name="xxx-jboss-master.vmdomain.org"/>

                      </virtual-server>

                      <virtual-server name="domain1-host" default-web-module="cluster-demo">

                          <alias name="xxx-jboss-domain1.vmdomain.org"/>

                      </virtual-server>

                      <virtual-server name="domain2-host" default-web-module="jboss-helloworld">

                          <alias name="xxx-jboss-domain2.vmdomain.org"/>

                      </virtual-server>

      </subsystem>

       

      After started domain controller, slave1, slave2 then httpd, the /mod_cluster-manager returns this :

      mod_cluster.png

      I have no context nor aliases defined to handle my requests.

       

      If i specify a default alias (<subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="master-host" native="false">), then the contexts are ok for mod_cluster-manager, cluster-demo and jboss-helloworld but the alias is unique (xxx-jboss-master.vmdomain.org). The 3 resources are accessible through http://xxx-jboss-master.vmdomain.org/<resource>

       

      I can't figure out what i'm missing but i'm sure there's something ...

       

      May you help ?

       

      Thanks in advance for your support.

       

      Kind regards.

       

      Richard

        • 1. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
          Dyego Miranda Bezerra Newbie

          If I really have understood the question, the only way that this problem was solved by creating a new profile in domain.xml and added the desired profile to this new server-group.

          Sorry for bad english and hope to have helped

          1 of 1 people found this helpful
          • 2. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
            rbe1733 Newbie

            Hi Dyego,

             

            Thanks for your answer and your english is far as good as mine :=))

             

            I had already created different socket-binding groups with a specific interface for each of the server group.

            Here is the configuration on the 3 VMs :

             

            VM1

            - host.xml

            interface domain1 : 192.168.100.201, domain2 : 192.168.100.202

            - domain.xml

            socket-binding-group domain1-group-sockets on interface domain1, socket-binding-group domain2-group-sockets on interface domain2

            server-group domain1-group with socket-binding-group=domain1-group-sockets and profile=full-ha

            server-group domain2-group with socket-binding-group=domain2-group-sockets and profile=full-ha

             

            VM2

            - host.xml

            interface domain1 : 192.168.100.211, domain2 : 192.168.100.212

            server cluster11 : server-group=domain1-group, socket-binding-group=domain1-group-sockets

            server cluster21 : server-group=domain2-group, socket-binding-group=domain2-group-sockets

             

            VM3

            - host.xml

            interface domain1 : 192.168.100.221, domain2 : 192.168.100.222

            server cluster12 : server-group=domain1-group, socket-binding-group=domain1-group-sockets

            server cluster22 : server-group=domain2-group, socket-binding-group=domain2-group-sockets

             

            socket-binding groups domain1-group-sockets and domain2-group-sockets are identical except for the listening interface.

            In other terms, the multicast addresses are equal between the 2 socket-binding groups.

             

            I don't understand why the different socket-binding groups are not sufficient to isolate the 2 clusters and the applications deployed on the belonging servers.

             

            May you precise how to configure different profiles in this context ?

            Do i need to configure one interface per profile ? What about socket-binding groups in this configuration ?

             

            Thanks again for helping.

             

            Richard

            • 3. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
              Dyego Miranda Bezerra Newbie

              Hi Richard,

              In my lab I just created a new profile using the same sokect bindings and for which profile I setted different alias names and on Apache I used the "UseAlias 1".

              I dont know if it escape from best pratices, but worked for me...

               

              I copied the "ha" profile with new name ("ha-ext") and different alias, and the server groups I choosed the profiles.

              • 4. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
                rbe1733 Newbie

                Hi Dyego,

                 

                Thanks for your feedback.

                 

                Making multiple profiles does the job.

                Now, the test applications are isolated on my diffrent virtual hosts.

                 

                However, i continue using multiple socket-bindings in order to have multiple interfaces.

                Thus, each server group has his own profile and socket-binding.

                 

                I ran extra tests and found that a major part of my jboss_cluster.conf file was useless.

                Here is the new configuration :

                 

                Listen 192.168.100.200:10001

                UseAlias 1

                AdvertiseFrequency 5

                ServerAdvertise on

                MemManagerFile /var/cache/httpd

                 

                <VirtualHost 192.168.100.200:10001>

                  <Directory />

                    Order deny,allow

                    Allow from all

                  </Directory>

                 

                  <Location /mod_cluster-manager>

                   SetHandler mod_cluster-manager

                   Order deny,allow

                   Allow from all

                  </Location>

                 

                  KeepAliveTimeout 60

                  MaxKeepAliveRequests 0

                 

                  ManagerBalancerName master-host

                  EnableMCPMReceive

                </VirtualHost>

                 

                I guess that an unique balancer is sufficient enough to handle the requests on the 2 server groups (MCPM belongs to the first virtualHost where it is declared)

                It seems you don't need to declare multiple balancers to make multiple virtual hosts work.

                 

                I will make extra tests later to see if it's possible to get rid off multiple profiles when you already have multiple socket-bindings.

                Maybe something to deal with default-virtual-server in the virtual servers declaration of jboss:domain:web subsystem ...

                 

                Thanks again for your help.

                 

                Richard

                • 5. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
                  jaikiran pai Master

                  Moved the topic to JBoss EAP forum.

                  • 6. Re: How to use multiple virtual servers in JBoss EAP 6.2.0 (AS 7.3.0)
                    rbe1733 Newbie

                    I made a mistake in my last post.

                    The /etc/httpd/conf.d/jboss_cluster.conf MUST contain the following directives in order to work :

                     

                    Listen 192.168.100.200:10001

                    Listen 192.168.100.201:10001

                    Listen 192.168.100.202:10001

                     

                    It is not necessary to declare the VirtualHost sections for .201 and .202 addresses but the listen parameters must be present.

                     

                    Kind

                     

                    Richard