【问题标题】:Spymemcached handling node for operation is not set未设置用于操作的 Spymemcached 处理节点
【发布时间】:2014-08-27 23:58:49
【问题描述】:

我有一个应该与 memcached 一起使用的简单代码。不幸的是,它不能正常工作。

这里是一个简化的代码sn-p:

MemcachedClinet memcached = new MemcachedClient(new ConnectionFactoryBuilder()
                    .setDaemon(true)
                    .setFailureMode(FailureMode.Cancel)
                    .build(),
                AddrUtil.getAddresses("192.168.178.27:11211"));

memcached.get(keyName);

这是我在执行过程中遇到的错误:

2014-08-28 01:47:46.577 INFO net.spy.memcached.MemcachedConnection:  Added {QA sa=/192.168.178.27:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2014-08-28 01:47:46.579 WARN net.spy.memcached.MemcachedConnection:  handling node for operation is not set
28-Aug-2014 01:47:46.579 SEVERE [http-nio-8080-exec-9] com.internetlogisticsinc.projects.xenu.core.Rotator.getCounter null
 java.util.concurrent.CancellationException: Cancelled
    at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:177)
    at net.spy.memcached.internal.GetFuture.get(GetFuture.java:69)
    at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1230)
    at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1257)
(...)

我完全不知道handling node for operation is not set 是什么意思会导致此错误消息。 Memcached 服务器工作正常,我可以用 telnet 连接到它,没有任何问题。 telnet 测试是在应用程序运行所在的同一台机器上完成的。

谷歌搜索 handling node for operation is not set 并没有给我带来任何有用的结果。

代码在 Apache Tomcat 8.0.3 中作为 servlet 执行,捆绑到 NetBeans 8.0 中。 Spymemcached 版本为 2.11.4。

你有什么想法吗?

感谢您的宝贵时间

【问题讨论】:

    标签: java memcached spymemcached


    【解决方案1】:

    首先检查您是否可以使用基本连接使用简单的 Java 类连接您的服务器。首先设置一个值,然后尝试检索它。

    MemcachedClient c=new MemcachedClient(new InetSocketAddress("hostname", portNum));
    

    当您没有正确配置节点时,多节点 memcache 配置中可能会引发此异常。

    【讨论】:

    • 我已经用你的代码更新了我的代码,结果是:
    • 2014-08-28 12:30:49.571 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/192.168.178.27:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2014-08-28 12:30:49.572 WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for com.example.test.
    • 您使用的是单个 memcached 节点还是多个节点?看起来是配置了多个节点,但实际上你只有一个节点。
    • 我只使用一个节点
    猜你喜欢
    • 1970-01-01
    • 2017-12-14
    • 2017-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多