Reputation: 103
i use libmemcached in "c" for write data whit MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA usage. All keys are well distributed along all clusters nodes, but when i shutdown one of these, the keys are not migrated. Searching on google is not clear how to setup libmemcached for doing' that automatically. Any one has some experience on that?
Upvotes: 2
Views: 880
Reputation: 11
Libmemcached does not internally handle key migration in case of memcached server failure. There will be cache miss in this case when the libmemcached tries to retrieve the key which was stored in a failed server.
If we use MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, it will just make sure the cache miss is minimum as the keys are distributed and complete rehashing is not required.
Solutions: You can replicate the keys across multiple nodes which will help you to retrieve the (key, value) pair in case of server failure. But note that it not a strongly consistent solution. There is possibility for stale data.
EVICT the servers that have failed, so that keys are hashed to new location and it gets removed from cluster.
Upvotes: 0
Reputation: 2699
I think you'll have to use: http://docs.libmemcached.org/memcached_behavior.html#MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS
If you don't allow libmemcached to remove failed servers, they get stuck in the list, hence the keys are not redistributed.
Note that the dead server would be tested again after MEMCACHED_BEHAVIOR_DEAD_TIMEOUT (see 1, 2) seconds. So if it's up again, it will be brought back into the full servers' list.
Upvotes: 1