4 Replies Latest reply on Oct 20, 2010 6:40 AM by mircea.markus

    Getting cache to join an existing distributed cluster

    gupabhi

      Hi,

          I've recently started evaluating infinispan and am encountering some teething problems.

      I used the infinispan GUI demo and started multiple instances that 'see' each other.  Now I wanted to use an embedded programatic cache that would become part of the same cluster. I cannot seem to get the embedded cache to become part of the demo cluster. Below is the code I used and the cache config. I do see it internally uses the udp transport (jgroups-udp.xml). Interestingly, I can run two instances of my embedded cache (same code below), and they form a cluster. Not sure what I'm missing.

       

      A second and more important question was, is there some page which gives examples of using a unicast way of discovering services ?  I cannot use multicast atall in my firm's environment.  Not just communication between the peers but the discovery too should be in a unicast way (file_ping?).  Is there some out of the box example to do this. I did look around but could'nt find.

       

      Please feel free to point me to specific links that might help explain to me the above points or anything related.

       

       

      Here's the code and config for my first question-

       

      EmbeddedCacheManager manager = new DefaultCacheManager("my-config-file.xml");
              Cache defaultCache = manager.getCache();
              defaultCache.start() ;
              defaultCache.put("key"+i, i) ;

       

       

      my-config-file.xml

      <infinispan>
        <global>
            <transport clusterName="demoCluster"/>
         </global>
         <default>
            <clustering mode="distribution">
               <l1 enabled="true" lifespan="60000"/>
               <hash numOwners="2" rehashRpcTimeout="120000"/>
               <sync/>
            </clustering>
         </default>
      </infinispan>

       

       

      Thanks,

      Abhi

        • 1. Re: Getting cache to join an existing distributed cluster
          mircea.markus

          Hi,

          Now I wanted to use an embedded programatic cache that would become part of the same cluster. I cannot seem to get the embedded cache to become part of the demo cluster.

          I suggest you add following VM params when you start the cluster:

          -Djgroups.bind_addr = IP - the ip of the network card where you want you cluster to bind to. If both nodes are running on the same machine, just add  -Djgroups.bind_addr=127.0.0.1. -Djava.net.preferIPv4Stack=true just to make sure that specified IP addresses are in IPv4 format.

          • 2. Re: Getting cache to join an existing distributed cluster
            mircea.markus

            re:discovery. it is possible to avoid using UDP entirely. You'll have to amend the jgroups configuration file to do that. though. FILE_PING is such a discovery protocol that relies on a shared network disk. ALternatively you can also use TCPPING or a gossip router. Refer to jgroup's documentation for more on this.

            1 of 1 people found this helpful
            • 3. Re: Getting cache to join an existing distributed cluster
              gupabhi

              Thanks Mircea. I've got my cluster to use TCP for communication and TCPPing for discovery.

              Two more related questions to communication -

               

              * I could not find any articles that discuss the pros and cons of the various discovery protocols in the context of infinispan. Points to ponder about might be related to redundancy, efficient, flexible, dynamic, single-point-of-failure, etc.

               

              * I see that infinispan ships with a hotrod server script and I've read how the hotrod server could be made part of the cluster. My question is, how does infinispan internally talk across the cluster? For example, in case of a sync-replicated cluster, does it send the entries across all nodes using hotrod or some other protocol, or can this be configured? I could not find an obvious way to configure it from this page (http://docs.jboss.org/infinispan/4.1/apidocs/config.html)

               

              Thanks in advance.

               

              -Abhi

              • 4. Re: Getting cache to join an existing distributed cluster
                mircea.markus
                * I could not find any articles that discuss the pros and cons of the various discovery protocols in the context of infinispan. Points to ponder about might be related to redundancy, efficient, flexible, dynamic, single-point-of-failure, etc.

                I can't think of any discovery aspects particular to Infinispan.

                I see that infinispan ships with a hotrod server script and I've read how the hotrod server could be made part of the cluster. My question is, how does infinispan internally talk across the cluster? For example, in case of a sync-replicated cluster, does it send the entries across all nodes using hotrod or some other protocol, or can this be configured? I could not find an obvious way to configure it from this page (http://docs.jboss.org/infinispan/4.1/apidocs/config.html)

                Hotrod is only used for clients to connect to an infinispan cluster. For communicating between its members (e.g. replicating state)  infinispan uses jgroups.