magent memcached集群已搭建好,magent取值问题

发布于 2021-11-28 09:48:28 字数 2956 浏览 773 评论 2

使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冬天旳寂寞 2021-11-29 04:30:21

是在windows下装的吗,magent怎么装的啊,有没有windows能不能教一下我啊,拜托了

刘备忘录 2021-11-28 23:39:59

没人?在线等..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文