I'm currently using Spring Boot version 3.1.0 along with GCP Memory Store, which serves as a Redis instance. However, I'm getting below exception while establishing a connection to Redis. I've attempted this connection using both a GCP Cloud Function and a Cloud Run Service.
io.lettuce.core.RedisConnectionException - Unable to connect to XX.XX.XXX.XXX/<unresolved>:6378
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1604)
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1360)
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1343)
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1061)
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:400)
org.springframework.data.redis.cache.DefaultRedisCacheWriter.execute(DefaultRedisCacheWriter.java:272)
org.springframework.data.redis.cache.DefaultRedisCacheWriter.get(DefaultRedisCacheWriter.java:122)
org.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:167)
org.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58)
Steps taken:
- Added dependency as
spring-boot-starter-data-redis
along withspring-boot-starter-cache
,lettuce-core
. - Added dependency
google-cloud-redis
(instead ofspring-boot-starter-data-redis
). - Added VPC connector to connect with redis.
- Added Configuration as below
I am trying to cache data and retrieve it from cache using Spring Boot version 3.1.0 along with GCP Memory Store, the connection should be established but it is unable.