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

Chance_ 发布于 2015/06/11 17:12
阅读 1K+
收藏 0

使用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)



加载中
0
Chance_
Chance_
没人?在线等..
0
w
wo_ai_dapeng

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

返回顶部
顶部