我正在尝试使用 AutoDiscovery 测试 Amazon 的新 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");
创建连接时,我在日志中看到以下内容。当我尝试设置一个值时会发生错误:
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)
- 我在本地和 EC2 实例上都试过了(我可以使用其他库连接到节点)
- 我试过同时使用 1.4.5 和 1.4.14 Memcached 引擎
- 我也放宽了安全组限制以防万一
关于配置端点为什么会超时的任何想法?