3rd-Eden / node-hashring

hashring is a consistent hashing algorithm for Node.js that is compatible with libketama and python's hash_ring package
MIT License
350 stars 61 forks source link

Adding new server #47

Closed KooT closed 7 years ago

KooT commented 7 years ago

First i have 3 servers:

var ring = new HashRing(['127.0.0.1:11211', '127.0.0.2:11211', '127.0.0.3:11211']);

And im geting 44 keys and match server to them (column one and two in big picture below) Then im adding new node:

ring.add( '127.0.0.4:11211');

And getting servers for the same ids - column 3 and 4 in big picture below)

Now server 4 has got ids from all other servers: 1 and 2 and 3, why?

image image image

When i am reading about consistent hashing - it looks like, when adding new node, only data from one node should be migrated, not from all nodes. Or am i wrong? ;

All data:

image

KooT commented 7 years ago

Ok i got it now :)