2 Replies Latest reply on Mar 9, 2012 11:30 PM by whizkid.samrat

    mod_jk to load balance between multiple Clusters , jBoss 4.2.3

    whizkid.samrat

      Hi ,

       

      I am farely new to clustering, but i have been able to cluster my application server and used mod_jk for load balencing. So far so good , but now my application will interact with another application which runs it's own cluster and sends request to my application over http.

       

      Here is the problem :

       

      My application AppA is using jBoss 4.2.3 and has two nodes - Node1 and Node2  and the  cluster partition name is partitionA , the other application AppB is using jBoss 4.0.2 and has it's nodes - Nodes 3 , Node 4 and the name of the cluster is partitionB.

       

      All 4 nodes (2 nodes for partitionA and 2 nodes for partitionB) are housed in the same physical server running four instances of jvm .

       

      I have only one instance of loadbalancer ( Apacle 2.0 with mod_jk 1.2) on port 80.

       

      I have 4 workers configured in workers.properties

       

      # Load-balancing behaviour

      worker.loadbalancer.type=lb

      worker.loadbalancer.balance_workers=node1,node2,node3,node4

      worker.loadbalancer.sticky_session=1

      #worker.list=loadbalancer

       

      Now in the uriworkermap.properties I state the following.

       

      # Mount the Servlet context to the ajp13 worker

      /AppA=loadbalancer

      /AppA/*=loadbalancer

       

      /AppB=loadbalancer

      /AppB/*=loadbalancer

       

       

      Nowhere do I mention AppA is running on PartitionA and AppB is running on PartitonB ?

       

      So how does mod_jk figure out which request to send to which cluster ? how do i go about configuring this senario .. Any leads will be most helpfull.

        • 1. Re: mod_jk to load balance between multiple Clusters , jBoss 4.2.3
          rhusar

          Hi Samrat,

           

          great question. The answer is "mod_jk domains". The domain is the concept that will allow loadbalancer to indentify which nodes to failover on to. So in your case 1->2, 2->1, 3->4 or 4->3. You will have to configure property worker.node1.domain=group1 for your workers.

           

          Check out this document to see how to configure https://community.jboss.org/wiki/LoadBalancingWithModjkDomainDirective

           

          HTH,

          Rado

          1 of 1 people found this helpful
          • 2. Re: mod_jk to load balance between multiple Clusters , jBoss 4.2.3
            whizkid.samrat

            Thanks Radoslav for your answer , I however did figure out a parallel way of acheving the same thing. Here are my config files :

             

            Workers.Properties :

             

            worker.list=hrisloadbalancer,cesLoadBalancer,status

             

            worker.template.type=ajp13

            worker.template.prepost_timeout=10000

            worker.template.connect_timeout=10000

            worker.template.socket_connect_timeout=10000

            worker.template.connection_pool_size=10

             

            worker.node1.reference=worker.template

            worker.node1.host=10.8.100.118

            worker.node1.port=18009

             

            worker.node2.reference=worker.template

            worker.node2.host=10.8.100.118

            worker.node2.port=28009

             

            worker.cssonode1.reference=worker.template

            worker.cssonode1.host=10.8.100.118

            worker.cssonode1.port=38009

             

            worker.cssonode2.reference=worker.template

            worker.cssonode2.host=10.8.100.118

            worker.cssonode2.port=48009

             

            worker.hrisloadbalancer.type=lb

            worker.hrisloadbalancer.balance_workers=node1,node2

            worker.hrisloadbalancer.sticky_session=True

             

            worker.cesLoadBalancer.type=lb

            worker.cesLoadBalancer.balance_workers=cssonode1,cssonode2

            worker.cesLoadBalancer.sticky_session=True

             

            worker.status.type=status

             

             

            uriworkermap.properties :

            # Simple worker configuration file

            # Mount the Servlet context to the ajp13 worker

            /jmx-console=hrisloadbalancer

            /jmx-console/*=hrisloadbalancer

            /web-console=hrisloadbalancer

            /web-console/*=hrisloadbalancer

            /hrms=hrisloadbalancer

            /hrms/*=hrisloadbalancer

             

            # Route request to loadbalancer for CES

            /CES=cesLoadBalancer

            /CES/*=cesLoadBalancer