Amazon ElasticCache自动发现 - 客户端未初始化

Moe*_*ars 6 java amazon-web-services spymemcached amazon-elasticache

我正在尝试使用AutoDiscovery测试亚马逊的新Memcached客户端.我有一个memcached节点,我可以使用XMemcached 1.3.5以及标准的SpyMemcached库连接到该节点.

我按照这里的说明操作:http://docs.amazonwebservices.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.html

代码几乎与示例相同,并且是:

String configEndpoint = "<server name>.rgcl8z.cfg.use1.cache.amazonaws.com";
Integer clusterPort = 11211;
MemcachedClient client = new MemcachedClient(new InetSocketAddress(configEndpoint, clusterPort));
client.set("theKey", 3600, "This is the data value");
Run Code Online (Sandbox Code Playgroud)

我在创建连接时在日志中看到以下内容.我尝试设置值时发生错误:

2013-01-04 22:05:30.445 INFO net.spy.memcached.MemcachedConnection:  Added {QA sa=/<ip>:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2013-01-04 22:05:32.861 INFO net.spy.memcached.ConfigurationPoller:  Starting configuration poller.
2013-01-04 22:05:32.861 INFO net.spy.memcached.ConfigurationPoller:  Endpoint to use for configuration access in this poll NodeEndPoint - HostName:<our-server>.rgcl8z.cfg.use1.cache.amazonaws.com IpAddress:<ip> Port:11211
2013-01-04 22:05:32.950 WARN net.spy.memcached.MemcachedClient:  Configuration endpoint timed out for config call. Leaving the initialization work to configuration poller.
Exception in thread "main" java.lang.IllegalStateException: Client is not initialized
at net.spy.memcached.MemcachedClient.checkState(MemcachedClient.java:1623)
at net.spy.memcached.MemcachedClient.enqueueOperation(MemcachedClient.java:1617)
at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:474)
at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:905)
at com.thinknear.venice.initializers.VeniceAssets.main(VeniceAssets.java:227)
Run Code Online (Sandbox Code Playgroud)
  • 我在本地和EC2实例上尝试了这个(我可以使用其他库连接到节点)
  • 我尝试过使用1.4.5和1.4.14 Memcached引擎
  • 我放宽了安全组的约束以防万一

有关为什么配置端点超时的想法?

小智 8

客户端将不会被初始化:不能直接连接至本地计算机,以亚马逊弹性缓存节点,你只能通过你的EC2访问machiene.If要检查,你可以从本地计算机远程登录,将无法连接我也是从suufered同样的问题.你可以从你的Ec2机器telnet它.所以在ec2机器上尝试你的代码它会工作.