使用CName从Java连接到加密的ElastiCache Redis

使用CName从Java连接到加密的ElastiCache Redis,java,ssl,redis,amazon-route53,amazon-elasticache,Java,Ssl,Redis,Amazon Route53,Amazon Elasticache,我使用spring数据中的莴苣驱动程序连接到使用传输加密的ElastiCache。当我尝试连接到分配给ElastiCache群集的Route53 CName时。我得到这个错误: Caused by: com.lambdaworks.redis.RedisException: Cannot retrieve initial cluster partitions from initial URIs [RedisURI [host='my.cname.net', port=6379]] at

我使用spring数据中的莴苣驱动程序连接到使用传输加密的ElastiCache。当我尝试连接到分配给ElastiCache群集的Route53 CName时。我得到这个错误:

Caused by: com.lambdaworks.redis.RedisException: Cannot retrieve initial cluster partitions from initial URIs [RedisURI [host='my.cname.net', port=6379]]
    at com.lambdaworks.redis.cluster.RedisClusterClient.loadPartitions(RedisClusterClient.java:507)
    at com.lambdaworks.redis.cluster.RedisClusterClient.initializePartitions(RedisClusterClient.java:481)
    at com.lambdaworks.redis.cluster.RedisClusterClient.connectClusterAsyncImpl(RedisClusterClient.java:335)
    at com.lambdaworks.redis.cluster.RedisClusterClient.connectClusterAsync(RedisClusterClient.java:273)
    at org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.doGetAsyncDedicatedConnection(LettuceClusterConnection.java:1250)
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.getAsyncDedicatedConnection(LettuceConnection.java:3466)
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.getDedicatedConnection(LettuceConnection.java:3487)
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.getConnection(LettuceConnection.java:3460)
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.sMembers(LettuceConnection.java:1998)
    ... 24 common frames omitted
以下是我用来连接的代码:

@Bean
public static RedisConnectionFactory connectionFactory() {
    Map<String, Object> source = Maps.newHashMap();
    source.put("spring.redis.cluster.nodes", "my.cname.net:6379");
    RedisClusterConfiguration clusterConfiguration = new RedisClusterConfiguration(new MapPropertySource("RedisClusterConfiguration", source));
    clusterConfiguration.setMaxRedirects(10);
    LettuceConnectionFactory factory = new LettuceConnectionFactory(clusterConfiguration);
    factory.setValidateConnection(false);
    factory.setUseSsl(true);
    return factory;
}
@Bean
公共静态RedisConnectionFactory connectionFactory(){
Map source=Maps.newHashMap();
put(“spring.redis.cluster.nodes”、“my.cname.net:6379”);
RedisClusterConfiguration clusterConfiguration=新的RedisClusterConfiguration(新的MapPropertySource(“RedisClusterConfiguration”,source));
setMaxRedirects(10);
LettuceConnectionFactory=新的LettuceConnectionFactory(集群配置);
factory.setValidateConnection(假);
setusesl(true);
返回工厂;
}

现在,当我将Cname替换为连接到ElastiCache集群的acual网络名称时,程序开始工作。有人知道为什么只有在使用Cname时程序才会失败吗?

我们在.NET客户端遇到了一个非常类似的问题。我认为问题是因为Redis端点是amazonaws.com域的证书,因此通过my.CName.net的CName连接到集群失败,因为该证书对该域无效。我们无法找到任何更改证书的方法,因此无法解决此问题,必须坚持在连接中使用实际的网络名称