5 Replies Latest reply on Apr 12, 2011 1:09 PM by Abdur Rahman

    How I can cluster Jboss servers to Single IP

    mohsinkamal84 Newbie

      Hello,

       

      Hope every one is fine.I'm new to Jboss App and unable to setup a cluster.

       

      What is scanario:

      -------------------------

      I have 2 web servers

      Web1  192.168.1.20

      Web2   192.168.1.21

       

      I have installed apache on it ,enabled mod_jk.

      I also have created uriworkermap.properties , mod-jk.conf  , workers.properties @ location /etc/httpd/conf

      I have configured  workers.properties and set Jboss servers IP.

      My Jboss server 1 IP is 192.168.1.30 Jboss2 is 192.168.1.31 , I have defined these IPs on   workers.properties on both web servers.

       

       

      I'm running Jboss server with following command:

      sh ./run.sh -c all -b 192.168.1.30 -Djboss.messaging.ServerPeerID=1

       

      Jboss2

      sh ./run.sh -c all -b 192.168.1.31 -Djboss.messaging.ServerPeerID=2

       

      My Jboss server is running fine.

       

      ===> Then I have placed  test pages on both servers.

       

      --------------------

      [root@webserver2 html]# pwd

      /var/www/html

      [root@web2 html]# cat index.html

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <html>

      <head>

      <title>Your Page Title</title>

      <meta http-equiv="REFRESH" content="0;url=http://192.168.1.31:8080/"></HEAD>

      <BODY>

      </BODY>

      </HTML>

      ~

       

       

      [root@webserver2 html]#

      --------------------

      On webserver1

       

      [root@web2 html]# pwd

      /var/www/html

      [root@web2 html]# cat index.html

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <html>

      <head>

      <title>Your Page Title</title>

      <meta http-equiv="REFRESH" content="0;url=http://192.168.1.30:8080/"></HEAD>

      <BODY>

      </BODY>

      </HTML>

      ~

       

       

      [root@web2 html]#

      --------------------

       

      When I access webserver IPs , my requests are forwading to Jboss servers fine and showing JBoss page.

       

      When I access 192.168.1.20 in browser its showing page through IP http://192.168.1.30:8080  and 

      192.168.1.21 in browser its showing page through IP http://192.168.1.31:8080

       

      Till now I think every thing is fine.

       

      *********************Imp********************

      What I want now is to use another IP and setup it as cluster , let say I want to setup an IP 192.168.1.40 and want to bound other two Ips to this so every time when request come from any web browser it shows results from IP http://192.168.1.40:8080 instead of Jboss servers IP.

       

      Mean either page is serverd by Jboss 1 or @ it shows result through .40.

      ---------------------------------------------------------------------------

       

      What we need to do , Can some one please provide exact steps.I'm stucked on this and servered alot but couldn't understand that how I can I achive this.

        • 2. How I can cluster Jboss servers to Single IP
          mohsinkamal84 Newbie

          They are communicating each other.

           

          --------------

          18:07:36,820 INFO  [DefaultPartition] I am (192.168.1.30:1099) received membershipChanged event:

          18:07:36,820 INFO  [DefaultPartition] Dead members: 0 ([])

          18:07:36,820 INFO  [DefaultPartition] New Members : 1 ([192.168.1.31:1099])

          18:07:36,820 INFO  [DefaultPartition] All Members : 2 ([192.168.1.30:1099, 192.168.1.31:1099])

          18:08:08,022 INFO  [GroupMember] org.jboss.messaging.core.impl.postoffice.GroupMember$ControlMembershipListener@1eecfa7 got new view [192.168.1.30:44721|5] [192.168.1.30:44721, 192.168.1.31:51230], old view is [192.168.1.31:36665|4] [192.168.1.30:44721]

          18:08:08,023 INFO  [GroupMember] I am (192.168.1.30:44721)

          18:08:08,023 INFO  [GroupMember] New Members : 1 ([192.168.1.31:51230])

          18:08:08,023 INFO  [GroupMember] All Members : 2 ([192.168.1.30:44721, 192.168.1.31:51230])

          --------------

           

          But still my question is their regarding fail over setup and configuring 192.168.1.40.

          • 3. How I can cluster Jboss servers to Single IP
            Abdur Rahman Newbie

            I have summarized the documentation for Clustering HTTP Sessions with Tomcat bellow:

             

            Two distinct functions must be performed:

              1. Session state replication (handled by JBoss)

              2. Load-balance of incoming invocations (requires additional software or hardware)

             

            Load balancing through mod_jk:

            The following is the example configuration:

             

            # Define the first node...

            worker.node1.port=8009

            worker.node1.host=node1.mycompany.com

            worker.node1.type=ajp13

            worker.node1.lbfactor=1

            worker.node1.local_worker=1

            worker.node1.cachesize=10

            # ...and the second node.

            worker.node2.port=8009

            worker.node2.host=node2.mycompany.com

            worker.node2.type=ajp13

            worker.node2.lbfactor=1

            worker.node2.local_worker=1

            worker.node2.cachesize=10

            # Now we define the load-balancing behaviour

            worker.loadbalancer.type=lb

            worker.loadbalancer.balanced_workers=node1, node2

            worker.loadbalancer.sticky_session=1

            worker.loadbalancer.local_worker_only=1

            worker.list=loadbalancer

            • 4. How I can cluster Jboss servers to Single IP
              mohsinkamal84 Newbie

              Thank you Abdur Rahman for taking you time.

               

              Here is my configrations:

              --------------------------------------------------------

              [root@webserver1 conf]# cat workers.properties

              # Define list of workers that will be used

              # for mapping requests

              # The configuration directives are valid

              # for the mod_jk version 1.2.18 and later

              #

              worker.list=loadbalancer,status

               

               

              # Define Node1

              # modify the host as your host IP or DNS name.

              worker.node1.port=8009

              worker.node1.host=192.168.1.30

              worker.node1.type=ajp13

              worker.node1.lbfactor=1

              # worker.node1.connection_pool_size=10 (1)

               

               

              # Define Node2

              # modify the host as your host IP or DNS name.

              worker.node2.port=8009

              worker.node2.host= 192.168.1.31

              worker.node2.type=ajp13

              worker.node2.lbfactor=1

              # worker.node1.connection_pool_size=10 (1)

               

               

              # Load-balancing behaviour

              worker.loadbalancer.type=lb

              worker.loadbalancer.balance_workers=node1,node2

               

               

              # Status worker for managing load balancer

              worker.status.type=status

              [root@webserver1 conf]#

              --------------------------------------------------------

               

              == > What I have to do now is to configure workers.properties as you guided.

               

               

              2. Load-balance of incoming invocations (requires additional software or hardware)

               

              >> I already have a Load Balancer , I think I have to configure 192.168.1.40 on load balancer interface so requests serverd through this IP.I'm on right track ???

               

              Any other configration which I need on my web server nodes or on Jboss servers ?

              • 5. How I can cluster Jboss servers to Single IP
                Abdur Rahman Newbie

                I this case mod_jk is used for load balancing on the tomcat side. You just need to configure a single web server on load balancer interface.