1
我有以下的駱駝,其投票的Redis:彈簧的Redis無法連接到遠程主機
from("timer://pollredis?fixedRate=true&period=5")
// poll redis
.setHeader("CamelRedis.Command", constant("LPOP"))
.setHeader("CamelRedis.Key", constant("shipments"))
// from redis, it is a producer, fetch with .to() !
.to(redisUri)
//
.choice().when(simple("${in.body} == null")).stop().otherwise()
//
.to("direct:internal").end();
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
jedisConnectionFactory.afterPropertiesSet();
RedisTemplate<?, ?> redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(jedisConnectionFactory);
redisTemplate.setDefaultSerializer(new StringRedisSerializer());
redisTemplate.afterPropertiesSet();
SimpleRegistry registry = new SimpleRegistry();
registry.put("redisTemplate", redisTemplate);
而且它的偉大工程。然而,當我從
redisUri = spring-redis://localhost:6379?redisTemplate=#redisTemplate
改變redisUri到
redisUri = spring-redis://[stuff].xavwv8.ng.0001.euw1.cache.amazonaws.com:6379?redisTemplate=#redisTemplate
我收到以下錯誤:
11:42:49.754 INFO Failed delivery for (MessageId: ID-ip-10-12-22-168-43293-1465299763162-0-1 on ExchangeId: ID-ip-10-12-22-168-43293-1465299763162-0-2). On delivery attempt: 0 caught: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool | org.apache.camel.util.CamelLogger.log(CamelLogger.java:159) [Camel (camel-1) thread #0 - timer://pollredis]
我檢查,我有機會獲得elasticache通過Telnet遠程登錄到它並通過使用redis-cli。
這是什麼Could not get a resource from the pool
連接到遠程主機時遇到的錯誤?
我的本地redis和彈性緩存redis正在運行2.8.24。跑駱駝2.17.1。
我檢出了[此線程](https://stackoverflow.com/questions/30447919/cannot-get-connection-for-redistemplate-for-spring-data-redis),它可能是一個版本的東西。 [camel-spring-redis](http://mvnrepository.com/artifact/org.apache.camel/camel-spring-redis/2.17.1)使用的是spring-data-redis 1.6.4.RELEASE和jedis 2.7。 3。另外,如果我刪除了'?redisTemplate =#redisTemplate'部分,但是沒有StringRedisSerializer :( –