10 Replies Latest reply on Jul 29, 2005 1:43 PM by nitinjain

    New to clustering

    nitinjain

      Hi There,

      I'm new to JBoss clustering. Can anyone provide me some help on how to create multiple node on same machine? How to implement load-balancing? How to deloy an .war. .rar and .ear files in clustered environment?

      I'm using JBoss 3.2.3

      Thanks in advance.

      --Nitin

        • 1. Re: New to clustering
          vignesh76

          Hi,

          To have multiple cluster nodes on the same machine, you would need a multihomed machine and then you could bind each jboss instance to a different IP adress by using

          run.sh -b <ip address>

          Though having a cluster just on one machine doesn't truly serve the purpose of clustering.

          For load balancing at the web tier, you can configure Apache web server as the frontend loadbalancer to load balance between multiple jboss nodes. For details refer to JBoss clustering docs available at.

          http://www.jboss.com/products/jbossas/docs

          For clustering session and entity beans and configuring JBoss clustering, please refer to JBoss clustering documentation that contains all the information you need.

          • 2. Re: New to clustering
            nitinjain

            Thanks for a quick and prompt reply.

            I've created multihomed machine by configuring multiple ip address on same machine with the help of loopback adapter.

            Now the documentation you refered talks about some mod_jk libraries. And moreover it says that i need to install apache web server explicitly.

            But tell do need to do it because JBoss bundles tomcat with it.

            Please provide a way out.

            Thanks in advance.

            --Nitin

            • 3. Re: New to clustering
              vignesh76

              Hi,

              Yeah JBoss has tomcat bundled with it and each jboss instance will have tomcat running on it. Since all web requests are handled by tomcat, you need a loadbalancer in front of your JBoss nodes to loadbalace web requests between your JBoss instances. Apache web server is meant for that purpose and mod_jk is the module in Apache that enables communication with tomcat and loadbalancing web requests between tomcat instances. You could use a hardware loadbalancer as well for the same. This is the first level of loadbalancing for web requests that are handled by tomcat within JBoss. The architecture you want to implement is not really clear but if your system has EJBs and if the EJB tier would reside on separate instances than your web tier (sevlets, JSPs etc) then you could have another level of loadbalancing for ejb requests. This is accomplished by configuring HA-JNDI for EJB JBoss instances and adding clustering tags for your EJBs. All this is clearly explained in the documentation.

              • 4. Re: New to clustering
                nitinjain

                Thanks once again.

                I want to know that what all changes we are supposed to make to configure multiple nodes on single machine. And please help me in enabling session replication.

                I have a web application (.war) archive which connects to some repository using a JNDI look up with help of a resource adapter and some third party apis'.

                Thanks,
                --Nitin

                • 5. Re: New to clustering

                  There are several ways to run multiple nodes from a single machine.

                  1) As noted in an earlier reply, you can configure multiple IP addresses on a machine and then start the JBoss server with an associated IP address (e.g., run.bat -c mynode1 -b 192.168.1.100)

                  2) You can use a single IP address as long as you use a different set of ports for each server. The easiest way to accomplish this is via the Service Binding Manager, as described in the Services Binding Management section of the JBoss AS Guide. http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html#d0e23108

                  If you require load balancing, it can be achieved using Apache mod_jk as noted in an earlier post. This process is described in Chapter 6 of the JBoss AS Clustering Guide. See the section on configuring session replication and installing mod_jk.
                  http://docs.jboss.org/jbossas/clustering/JBossClustering7.pdf


                  The installation and configuration of mod_jk is also discussed on the JBoss Clustering wiki at http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss.

                  The wiki page notes that the worker.nodex.local_worker=1 entries in the configuration file must be commented out to achieve load balancing. This information isn't currently provided in the Clustering Guide so you need to do this if you want load balancing.

                  • 6. Re: New to clustering
                    nitinjain

                    Thanks for help.

                    I'm successfully able to set up the clustering environment on a single machine.

                    The only thing that i'm not able to set up is the method of clustering.

                    Is their any way to configure the method it should use,
                    1) Round-Robin,
                    2) First Available, and,
                    3) First AvailableIdenticalAllProxies

                    Thanks in advance.

                    Regards,
                    Nitin

                    • 7. Re: New to clustering
                      vignesh76

                      Hi Nitin,

                      mod_jk currently supports only one method of load balancing i.e, weighted round robin. As you may be aware now, the workers.properties configuration file defines the configuration for each node as follows.

                      # Define list of workers that will be used
                      # for mapping requests
                      worker.list=loadbalancer,status
                      # Define Node1
                      worker.node1.port=8009
                      worker.node1.host=node1.mydomain.com
                      worker.node1.type=ajp13
                      worker.node1.lbfactor=1
                      #worker.node1.local_worker=1 (1)
                      worker.node1.cachesize=10

                      # Define Node2
                      worker.node2.port=8009
                      worker.node2.host= node2.mydomain.com
                      worker.node2.type=ajp13
                      worker.node2.lbfactor=1
                      #worker.node2.local_worker=1 (1)
                      worker.node2.cachesize=10

                      Here the value for "worker.node1.lbfactor" defines the weightage to be given to the node. For instance if Node1 has 3 and Node2 has 1 for "worker.node1.lbfactor", the round robin ratio would be 3:1, i.e for every 4 requests 3 will go to Node1 and 1 will go to Node2.

                      You may read more about it at

                      http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss

                      • 8. Re: New to clustering
                        nitinjain

                        Thanks for all the help.

                        I'm able to set up clustering and load-balancing and even session replication.

                        But still while replicationg sessions an error is coming on JBoss console (commandline window)

                        17:23:19,747 WARN [InstantSnapshotManager] Failed to replicate sessionID:T+fXOD
                        k+IU+oOPP8BjId4w**.node2
                        javax.ejb.EJBException: Exception in setHttpSession: javax.ejb.EJBException: Exc
                        eption in setHttpSession: RuntimeMBeanException: RuntimeException in MBean opera
                        tion 'invoke(org.jboss.invocation.Invocation)'
                        Cause: javax.ejb.EJBException: java.io.NotSerializableException: org.apache.cata
                        lina.core.ApplicationContextFacade
                        at org.jboss.ha.httpsession.server.ClusteredHTTPSessionService.setHttpSe
                        ssion(ClusteredHTTPSessionService.java:117)
                        at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:324)
                        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
                        nDispatcher.java:284)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy39.setHttpSession(Unknown Source)
                        at org.jboss.web.tomcat.session.ClusterManager.storeSession(ClusterManag
                        er.java:615)
                        at org.jboss.web.tomcat.session.InstantSnapshotManager.snapshot(InstantS
                        napshotManager.java:39)
                        at org.jboss.web.tomcat.session.ClusteredSessionValve.invoke(ClusteredSe
                        ssionValve.java:89)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:641)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:480)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
                        2417)
                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
                        ava:180)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:643)
                        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
                        rValve.java:171)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:641)
                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
                        ava:172)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:641)
                        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
                        yAssociationValve.java:65)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:641)
                        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
                        577)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:641)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:480)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
                        ve.java:174)
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        t.invokeNext(StandardPipeline.java:643)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:480)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:19
                        7)
                        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)

                        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
                        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
                        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
                        va:615)
                        at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
                        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
                        ool.java:677)
                        at java.lang.Thread.run(Thread.java:534)


                        Can you please provide any help on this?

                        But session in getting replicated properly.

                        Thanks
                        Nitin

                        • 9. Re: New to clustering
                          vignesh76

                          Hi Nitin,

                          From the stack trace, it seems like an object that you are adding to the session is not Serializable. Ensure that all objects that need to be in the session are serializable.

                          • 10. Re: New to clustering
                            nitinjain

                            Hi Vignesh,

                            I've verified that all the objects taht i'm adding in session are serializable.

                            But the session is getting replicated properly.

                            Moreover at the the end it is also giving connection timeout reached.

                            I have three nodes.

                            Regards,
                            Nitin