Chantz Chantz - 1 year ago 409
Java Question

HOWTO Resolve warning messages of "restributing to another node" when using Spymemcached client library for memcached server

I am using spymemcached client library

provided by couchbase folks. The memcached server installed is version

The configuration for memcached is pretty basic >
-m 64 -p 11211 -u memcache -l

I am able to proper get, set, delete requests using the client library. But going through my logs I notice the warning messages from the spymemcached library like so -

WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for ...

I am not sure why is trying to redirect to another node in the cluster if there does not exist one.

I am connecting to the cache client using the below code -

String address =;
new MemcachedClient(new ConnectionFactoryBuilder().setDaemon(true).build(), AddrUtil.getAddresses(address));

Any help appreciated.

Answer Source

By default Spymemcached will redistribute an operation to an different node if the primary node is not available. If you had another node this would happen, but since there is only one then redistributing is the same as retrying the operation on the primary node. In your case this message is a little bit confusing. If you never want to redistribute an operation then you can do the following.

String address =;
new MemcachedClient(new ConnectionFactoryBuilder().setDaemon(true).setFailureMode(FailureMode.RETRY).build(), AddrUtil.getAddresses(address));

If sounds like your client might have lost connection to the server and reconnected at some point.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download