9 Replies Latest reply on Sep 24, 2007 5:25 AM by haribaasha

    question on clustering

    haribaasha

      Hi
      I have setup a cluster of 4 machines, the ejb resides in 3 machines and the remote call is made from the other machine

      -----------------------------server 1

      -----server 2---------------server 3-----------server 4

      hence the service resides as a ejb in 2 ,3 and 4, calls are made to this via HAJNDI from 1. hence the load is balanced between 2,3 and 4. 1 is more like my central server.

      now can i remove any of the machines (2 or 3 or 4) from the cluster at runtime ?

      it shouldnt be shutting down the machine, but by configuration alone (preferrably on the server 1) i should be able to reduce the cluster to 3 machines. 1 will always be part of the cluster.



        • 1. Re: question on clustering
          brian.stansberry

          You can't exclude 2, 3 or 4 via some operation on 1. If you don't want to shut down 2, 3 or 4 you can undeploy the EJB on one of them.

          • 2. Re: question on clustering
            haribaasha

            here is how i setup the cluster itself
            i added the ip's of the other machines to the initial_hosts list in the cluster-service.xml of that machine. Is tat all ?

            <TCPPING initial_hosts="10.1.30.201[7800]" port_range="3"
            timeout="3000"
            down_thread="false" up_thread="false"
            num_initial_members="3"/>

            incase i want to add/delete a node from a cluster itself i have to manually remove the ip entry from the cluster-service.xml of every machine ?

            • 3. Re: question on clustering
              brian.stansberry

              If you want automatic discovery of members, you can use multicast-based MPING instead of TCPPING: http://wiki.jboss.org/wiki/Wiki.jsp?page=JGroupsMPING.

              Regular traffic between the members would still use TCP; UDP multicast is used when a node joins the cluster and needs to dynamically discover the cluster members.

              With TCPPING, yes, you should list all members.

              • 4. Re: question on clustering
                haribaasha

                thanks alot, i will check mping.

                with mping i wont have to have the ips of the other machines in the service and hajndi wud work across the nodes in the cluster? that is the machines with the ejb deployed will be clustered for the service automaticallly ?

                • 5. Re: question on clustering
                  brian.stansberry

                  Correct.

                  Note that none of this changes my response to your first question. If you want to take the EJB on 2, 3 or 4 out of the cluster, you need to either undeploy it on that node or shut down that node.

                  • 6. Re: question on clustering
                    haribaasha

                    one last question , in my setup i mentioned in the first post i want the servers 2,3 and 4 to have a different partition name and 1 (central server which routes the requests to 2,3,4) to have a different partition name. is this possible ? or will this result in the lookup failing ?

                    • 7. Re: question on clustering
                      brian.stansberry

                      Yes, they can be in separate partitions. But, your client on node 1 will not be able to query it's own HA-JNDI to find the EJB, because its HA-JNDI will not have visibility to 2/3/4.

                      Simplest way to deal with this is to pass environment properties to your InitialContext to tell it how to find HA-JNDI on the 2/3/4 partition. E.g.

                      Hashtable env = new Hashtable();
                      // We want to discover the 234Partition
                      env.put("jnp.partitionName", "234Partition");
                      // The 234Partition is using a different mcast address than we are
                      env.put("jnp.discoveryGroup", getMulticastAddressFor234Partition());
                      Context ctx = new InitialContext(env);
                      


                      You could also encapsulate the above 2 properties in a .properties file and load them from the file. Don't call that file jndi.properties though!!

                      See http://wiki.jboss.org/wiki/Wiki.jsp?page=NamingContextFactory for more on these properties.

                      • 8. Re: question on clustering
                        haribaasha

                        Instead of
                        Properties p = new Properties();
                        p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                        p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
                        p.put(Context.PROVIDER_URL, "localhost:1100"); // HA-JNDI
                        // port
                        initial = new InitialContext(p);

                        i did this :
                        Hashtable env = new Hashtable();
                        env.put("jnp.partitionName", "IndicsPartition");
                        env.put("jnp.discoveryGroup", "230.0.0.5" );
                        initial = new InitialContext(p);

                        and i changed the ip in the indicspartition machine to 230.0.0.5

                        i got a communication exception on the client side ??

                        is this all or am i missing something ?

                        • 9. Re: question on clustering
                          haribaasha

                          am sorry , its working perfectly fine. i had screwed up with the partition name in the second partition :)

                          thanks a lot!