0

I am trying to figure out what exactly is the logic behind deciding redis node to store data when using ShardedJedis class in Jedis. What exactly is the algorithm used for distributing data among nodes?

1 Answers1

1

If you examine the source code you'll see that Jedis shards by hashing the entire the key's name. The relevant functions are called 'getShard' and 'getShardInfo' (lines 77-87).

Itamar Haber
  • 47,336
  • 7
  • 91
  • 117
  • I already checked that you. But, What I don't understand is the mapping created in `nodes` starting https://github.com/xetorthio/jedis/blob/master/src/main/java/redis/clients/util/Sharded.java#L53 Is this a standard strategy used in such systems or improvisation as per se? – Sitesh Shrivastava May 22 '14 at 19:45