magent memcached集群已搭建好,magent取值问题
使用magent搭建了两台memcached集群,通过XMencached客服端操作magent代理set值正常,取值却一直报session关已闭。但可通过单独的memcached取值正常,求解
magenta地址:192.168.1.25:12000
memcached1:192.168.1.25:11211
memcached2:192.168.1.26:11211
MemcachedClientBuilder builder = new XMemcachedClientBuilder( AddrUtil.getAddresses("192.168.1.25:12000")); MemcachedClient memcachedClient = null; try { memcachedClient = builder.build(); // memcachedClient.set("name1", 0, "zhangsan1"); // memcachedClient.set("name2", 0, "zhangsan2"); // memcachedClient.set("name3", 0, "zhangsan3"); // memcachedClient.set("name4", 0, "zhangsan4"); String value1 = memcachedClient.get("name1"); String value2 = memcachedClient.get("name2"); String value3 = memcachedClient.get("name3"); String value4 = memcachedClient.get("name4"); System.out.println("hello=" + value1); System.out.println("hello=" + value2); System.out.println("hello=" + value3); System.out.println("hello=" + value4); //memcachedClient.delete("hello"); //value = memcachedClient.get("hello"); //System.out.println("hello=" + value); } catch (MemcachedException e) { System.err.println("MemcachedClient operation fail"); e.printStackTrace(); } catch (TimeoutException e) { System.err.println("MemcachedClient operation timeout"); e.printStackTrace(); } catch (InterruptedException e) { // ignore } catch (IOException e) { e.printStackTrace(); }
报如下错:
MemcachedClient operation fail net.rubyeye.xmemcached.exception.MemcachedException: Session has been closed at net.rubyeye.xmemcached.impl.MemcachedTCPSession.destroy(MemcachedTCPSession.java:111) at net.rubyeye.xmemcached.impl.MemcachedHandler.onSessionClosed(MemcachedHandler.java:164) at com.google.code.yanf4j.core.impl.AbstractSession.onClosed(AbstractSession.java:305) at com.google.code.yanf4j.core.impl.AbstractSession.close(AbstractSession.java:293) at com.google.code.yanf4j.nio.impl.NioTCPSession.decode(NioTCPSession.java:311) at com.google.code.yanf4j.nio.impl.NioTCPSession.decodeAndDispatch(NioTCPSession.java:237) at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:207) at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:196) at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:341) at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56) at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157) at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:295) at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:142)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是在windows下装的吗,magent怎么装的啊,有没有windows能不能教一下我啊,拜托了
没人?在线等..