के लिए मेम्बेस क्लाइंट lib का उपयोग करके AWS ElastiCache क्लस्टर से कनेक्ट करने में असमर्थ, मुझे अपने EC2 इंस्टेंस से ElastiCache क्लस्टर में प्राप्त/सेट करने में समस्याएं आ रही हैं। मुझे मिल रहा है - SEVERE: net.spy.memcached.OperationTimeoutException: Timeout waiting for value
- त्रुटि।memcached
जब मैं कोई मूल्य प्राप्त करने या सेट करने का प्रयास कर रहा हूं। मैंने अपनी स्थानीय मशीन पर एक ही कोड का इस्तेमाल किया (यद्यपि एक स्थानीय memcached सर्वर के साथ संचार) और सब कुछ ठीक काम करता है। पूरा स्टैकट्रेस यहां पाया जा सकता - http://pastebin.com/tYcCJ6cj
मैं पहली बार देखा कि मैं कम से कम इतना है कि मैं इसे अपने membase ग्राहक & करने के लिए फ़ीड कर सकते हैं मैं वास्तव में लगता है करने में सक्षम हूँ एक क्लस्टर के सभी नोड्स के आईपी पते प्राप्त कर सकते हैं नोड आईपी पते बाहर। मैंने यह भी सुनिश्चित किया है कि मेरे सभी ईसी 2 सुरक्षा समूह डिफ़ॉल्ट कैश क्लस्टर सुरक्षा समूह में भी जोड़े गए हैं।
इस पर कोई भी पॉइंटर्स बहुत उपयोगी होगा।
अद्यतन
कोड एक विशेष रिकॉर्ड लाने के लिए इस्तेमाल किया स्निपेट।
public String getCachedValue(String namespace, String key) {
String value = null;
try {
MemcachedClient client
= CacheConnectionUtil.connectToElastiCacheMemcachedServer();
// Point of origin for the exception.
return (String) client.get(namespace + "$" + hashKey(key));
} catch (IOException e) {
e.printStackTrace();
}
return value;
}
कोड ElastiCache सर्वर
private static MemcachedClient connectToElastiCacheMemcachedServer()
throws IOException {
DescribeCacheClustersResult cacheClustersInfo = null;
DescribeCacheClustersRequest cacheClusterRequest
= new DescribeCacheClustersRequest();
cacheClusterRequest.setShowCacheNodeInfo(true);
try {
cacheClustersInfo = AWSConnectionUtil
.getElastiCacheObject(null)
.describeCacheClusters(cacheClusterRequest);
} catch (Exception e) {
e.printStackTrace();
throw new IOException("Unable to connect to ElastiCache Cluster.", e);
}
if (cacheClustersInfo == null) {
throw new IOException("ElastiCache Cluster Info Object is null.");
}
List<CacheCluster> clusters = cacheClustersInfo.getCacheClusters();
if (clusters == null || clusters.isEmpty()) {
throw new IOException("No ElastiCache Clusters available.");
}
List<String> serverList = new ArrayList<String>();
for (CacheCluster cluster : clusters) {
if (cluster != null
&& AWSConstants
.CACHE_CLUSTER_ID
.equalsIgnoreCase(cluster.getCacheClusterId())) {
List<CacheNode> nodes = cluster.getCacheNodes();
if (nodes != null) {
for (CacheNode node : nodes) {
if (node != null) {
Endpoint endpoint = node.getEndpoint();
if (endpoint != null
&& endpoint.getAddress() != null) {
serverList.add(endpoint.getAddress()
+ ":"
+ endpoint.getPort());
}
}
}
}
}
}
if (serverList.isEmpty()) {
throw new IOException("No Cached nodes available for cluster - "
+ AWSConstants.CACHE_CLUSTER_ID);
}
return new MemcachedClient(AddrUtil.getAddresses(serverList));
}
क्या आप अपना कोड पोस्ट कर सकते हैं? यह देखने के बिना कि आप क्या कर रहे हैं, इस समस्या का निदान करना संभव नहीं है। स्टैक ट्रेस बस कहता है कि ऑपरेशन को पूरा करने में बहुत लंबा लगा। – mikewied
@mikewied कृपया कोड स्निपेट वाले अद्यतन प्रश्न देखें। धन्यवाद। – Chantz
आपका कोड सही दिखाई देता है और मेरे पास कुछ भी नहीं है जो मुझ पर कूदता है। मैं सिर्फ दोबारा जांच करूंगा कि पता/पोर्ट संयोजन सही है। यदि ऐसा है तो आप उस कोड से क्लस्टर में मशीनों में से किसी एक को टेलनेट करने का प्रयास करें, यह कोड चल रहा है और यह देखने के लिए जांचें कि क्या आप प्राप्त कर सकते हैं। – mikewied