복붙노트

[REDIS] 아마존 Elasticache 레디 스 클러스터 - 엔드 포인트를 가져올 수 없습니다

REDIS

아마존 Elasticache 레디 스 클러스터 - 엔드 포인트를 가져올 수 없습니다

나는 아마존 Elasticache의 레디 스 클러스터에 대한 엔드 포인트를 얻을 필요가있다. 다음 코드는 아니지만 레디 스를 들어, Memcached가 클러스터에 대한 작동합니다 :

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;

import com.amazonaws.services.elasticache.AmazonElastiCacheClient;
import com.amazonaws.services.elasticache.model.DescribeCacheClustersRequest;
import com.amazonaws.services.elasticache.model.DescribeCacheClustersResult;
import com.amazonaws.services.elasticache.model.CacheNode;
import com.amazonaws.services.elasticache.model.CacheCluster;
import com.amazonaws.services.elasticache.model.Endpoint;

public class Redis {
    public static void main(String[] args) {
        AWSCredentials credentials = 
            new ProfileCredentialsProvider("default").getCredentials();
        AmazonElastiCacheClient amazonClient = new AmazonElastiCacheClient(credentials);
        amazonClient.setRegion(Regions.EU_WEST_1);
        DescribeCacheClustersRequest dccRequest = new DescribeCacheClustersRequest();
        dccRequest.setShowCacheNodeInfo(true);
        dccRequest.withCacheClusterId("app-001");
        DescribeCacheClustersResult clusterResult = 
            amazonClient.describeCacheClusters(dccRequest);

        CacheCluster cacheCluster = clusterResult.getCacheClusters().get(0);
        System.out.println("cluster: " + cacheCluster);
        System.out.println("endpoint: " + cacheCluster.getConfigurationEndpoint());
    }
}

출력은 다음과 같습니다

cluster: {CacheClusterId: app-001,ClientDownloadLandingPage: https://console.aws.amazon.com/elasticache/home#client-download:,CacheNodeType: cache.r3.large,Engine: redis,EngineVersion: 2.8.19,CacheClusterStatus: available,NumCacheNodes: 1,PreferredAvailabilityZone: eu-west-1a,CacheClusterCreateTime: Thu May 21 11:43:03 CEST 2015,PreferredMaintenanceWindow: mon:04:00-mon:05:00,PendingModifiedValues: {CacheNodeIdsToRemove: [],},CacheSecurityGroups: [],CacheParameterGroup: {CacheParameterGroupName: default.redis2.8,ParameterApplyStatus: in-sync,CacheNodeIdsToReboot: []},CacheSubnetGroupName: default,CacheNodes: [{CacheNodeId: 0001,CacheNodeStatus: available,CacheNodeCreateTime: Thu May 21 11:43:03 CEST 2015,Endpoint: {Address: app-001.3pusxn.0001.euw1.cache.amazonaws.com,Port: 6379},ParameterGroupStatus: in-sync,CustomerAvailabilityZone: eu-west-1a}],AutoMinorVersionUpgrade: true,SecurityGroups: [{SecurityGroupId: sg-3231f657,Status: active}],ReplicationGroupId: app,SnapshotRetentionLimit: 0,SnapshotWindow: 22:00-23:00}
endpoint: null

참고 클러스터 객체가 엔드 포인트 정보 (키 : 엔드 포인트)를 포함하는 방법, 그럼에도 불구하고 getConfigurationEndpoint 반환 널 (null)입니다.

어떻게 엔드 포인트를받을 수 있나요?

해결법

  1. ==============================

    1.그것은 일반적으로 발생, 나는 바로 질문을 게시 한 후 해결책을 발견했다. 레디 스에서 당신은 캐시 노드에 액세스 할 수 있습니다 :

    그것은 일반적으로 발생, 나는 바로 질문을 게시 한 후 해결책을 발견했다. 레디 스에서 당신은 캐시 노드에 액세스 할 수 있습니다 :

    cacheCluster.getCacheNodes().get(0).getEndpoint());
    
  2. from https://stackoverflow.com/questions/30371893/amazon-elasticache-redis-cluster-cant-get-endpoint by cc-by-sa and MIT license