java spymemcached,在Java中设置Amazon ElastiCache w / spymemcached

我一直无法在亚马逊云上找到有关Memcached的优秀教程,而且我对这个缓存技术很陌生。

我试图通过Amazon的ElastiCache服务和一个spymemcached客户端来使用memcached来实际执行memcached调用。

这就是我现在在Java中所做的:

try {

ConnectionFactoryBuilder connectionFactoryBuilder = new ConnectionFactoryBuilder();

MemcachedClient memcachedClient = new MemcachedClient(

connectionFactoryBuilder.build(),

AddrUtil.getAddresses(".cache.amazonaws.com:11211"));

memcachedClient.set("test", 12, new Integer(12));

System.out.println(memcachedClient.get("test"));

} catch (IOException ioException) {

ioException.printStackTrace();

}我尝试这样做时遇到的错误是:

java.net.ConnectException: Connection refused

at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)

at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:414)

at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:278)

at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1981)

2012-02-01 19:25:35.415 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=.cache.amazonaws.com/184.73.64.56:11211, #Rops=0, #Wops=2, #iq=0, topRop=null, topWop=net.spy.memcached.protocol.ascii.StoreOperationImpl@be8c3e, toWrite=0, interested=0}, attempt 1.

net.spy.memcached.OperationTimeoutException: Timeout waiting for value

at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1142)

at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1157)

at com.amazon.imaging.demo.SQSQueueManager.requeue(SQSQueueManager.java:117)

at com.amazon.imaging.demo.SQSQueueManager.requeue(SQSQueueManager.java:88)

at com.amazon.imaging.demo.DemoUI$4.run(DemoUI.java:368)

at com.amazon.imaging.demo.DemoUI.main(DemoUI.java:391)

Caused by: net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: .cache.amazonaws.com/184.73.64.56:11211

at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:65)

at net.spy.memcached.internal.GetFuture.get(GetFuture.java:37)

at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1135)

... 5 more任何人有任何想法或经验与此?

谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值