I guess you'd have to plug in your own consietent hash function that should be able to hash a certain key based to a specific address (hashFunctionClass config attribute).
So, numOwners is number of replicas ?
i am going through org.infinispan.configuration.cache.HashConfiguration But, it has no provision to point to the identity(ip address ) of the replica...
If i understand correctly, below is the concept of numOwners. Please correct me if i am wrong.
I have a cluster of 3 nodes. A, B, C. on each node numOwners is set to 1.
That means, A's back up is B
B's back up is C
C's back up is A.
Thanks for the reply.
I went through the link. Does this "Consistent hashing" algorithm default hashing algorithm that infinispan use?
I don't understand the question.
Does infinispan come with default hashing algorithm or user must implement his own hashing algorithm?
Obviously, there's a default hashing algorithm shipped.
As you mentioned that "backup of each key is decided at runtime", is there any way to find out that which server will be the backup of other server.
I think, Backup server means till the primay server runs backup server will not handle any request, all the request would be handled by the primary server.
if not configure primary and secondary server then how we can find out the backup or secondary server of the particular server, so that in case of the maintence we are sure that backup server is up.
Thanks in advance
Vishnu, the backup is "per key" and not "per server". All servers are active all the time. Therefore when I request a key it will always go to the primary node as computed by the consistent hash algorithm. If that node fails, the cluster recomputes the consistent hash for the keys it was holding, using the backups that are available on the other nodes and ensuring that keys will be on "numOwners" servers again. Here's an example:
- 3 servers (X Y Z) with a cache in distributed mode with numOwners=2
- cache.put("a", "a"); // the consistent hash algorithm decides to place key "a" on X and Y
- cache.put("b", "b"); // the consistent hash algorithm decides to place key "b" on Y and Z
- cache.put("c", "c"); // the consistent hash algorithm decides to place key "c" on X and Z
As you can see both keys "a" and "c" are on server X as primary but have different backups.
The AdvancedCache API has a method called "locate" which allows you to find the owners of a specific key.
Thanks for reply.
I have downloaded the inifinispan-all.jar.
i am running the server using the >startServer.bat -r memcached -c ../etc/config-samples/config.xml -l 188.8.131.52 -p 8180
The config file having all the configuration and transport tag having a configuration file,tcp.xml file which having all the server information as follow.
and another server running on same machine but port Num 8280. Now,i want to check the put value from one Server replicate to other.
Could you please share your experience on it.
Thanks in advance.
You could use any memcached client to check the contents. Alternatively enable JMX statistics and browse to the cache mbean with jvisualvm to see if any put/get operations are happening.