Project: springxd
Issue XD-2675: Add support for Sentinel in Redis Sink
Currently, the Redis sink appears to be unable to write to a Redis instance if it is connected via Sentinel. Given the following XD Container {{servers.yml}} configuration: {noformat} # Redis properties spring: redis: # port: 6379 # host: localhost sentinel: master: spring-xd nodes: 10.85.30.133:26379,10.85.30.134:26379,10.85.30.135:26379 {noformat} a stream of {{time | redis --key=ticktock}} results in the following: {noformat} Created JedisPool to master at 10.85.30.130:6379 Caused by: org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler#0]; nested exception is 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 Caused by: 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 at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:140) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:229) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:57) Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.jedis.JedisPool.getResource(JedisPool.java:84) at redis.clients.jedis.JedisPool.getResource(JedisPool.java:10) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:133) Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused at redis.clients.jedis.Connection.connect(Connection.java:150) at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:71) at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1783) at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:65) at redis.clients.jedis.Connection.connect(Connection.java:144) {noformat} The parts that sticks out to me is the line bq. {{Created JedisPool to master at 10.85.30.130:6379}} The Sentinels aren't at {{.130}}, that's a Redis and the only way that the {{JedisPool}} could know about that host is to have connected to a Sentinel instance and requested the listing of Redis nodes managed by the Sentinel. Notably, the Redis instance that the JedisPool connects to is actually responsive. {noformat} $: redis-cli -h 10.85.30.130 -p 6379 10.85.30.130:6379> ping PONG 10.85.30.130:6379> {noformat}
Story points: 3