3 Replies Latest reply on Dec 11, 2008 11:01 PM by brian.stansberry

    AutoDiscovery for multiple clusters on same machine

      Hello,

      I have a machine that is running two instances of JBoss 4.2.2. Each of the instances participates in a different cluster. Both clusters are running the same EJB application.

      How do I configure the jndi.properties on my client such that it can auto discover both the clusters?

      Because they are running on the same machine, their auto discovery address and ports are different. But the jndi.properties file takes only 1 pair of values for jnp.discoveryGroup and jnp.discoveryPort. So it can auto discovery only one of the two clusters.

      Is there a way to work with such a setup?

      Specifying the provider URLs for each of the nodes in the cluster is difficult to maintain with lot of nodes.

      Thanks,

      Shreyas

        • 1. Re: AutoDiscovery for multiple clusters on same machine
          brian.stansberry

          You need to use a separate InitialContext with a distinct set of naming environment properties for each cluster. Even if autodiscovery could be configured to discover both clusters, the downloaded naming proxy would come from one or the other and would only be able to connect to servers in that cluster.

          Why are you trying to auto-discover two clusters? Is this really a sign that for this particular application you should have a single partition? (You can deploy more than one partition on an AS, so all servers could be part of a single partition for this application, while maintaining separate partitions for whatever else you're doing that led you to create 2 clusters.)

          • 2. Re: AutoDiscovery for multiple clusters on same machine

            Thanks Brian. I understand your comment and I agree with it.

            How does a client look up two different EJB applications deployed on two different clusters?

            Can jndi.properties work in this case? In this case, I do understand that the proxy downloaded will be from one of the clusters.

            Do I load the naming environment for each cluster one at a time?

            Thanks,

            Shreyas







            • 3. Re: AutoDiscovery for multiple clusters on same machine
              brian.stansberry

              To look up two different EJB applications deployed on two different clusters, the client will need to create more than one InitialContext.

              The contents of jndi.properties will be combined with whatever other properties you
              pass in via a call to new InitialContext(Hashtable<?,?> environment). So I would recommend you create a utility class with methods to create an appropriate "Hashtable<?,?> environment", one for each cluster. The returned Hashtable would include the cluster-specific environment properties; any properties that are common could come from jndi.properties.

              How you populate each cluster specific Hashtable is up to you, but I'd recommend externalizing the information in properties files, e.g. clusterA.properties and clusterB.properties.