I have a Spring Boot 3 based project. Which uses the Ridis server as DB.It is a simple project and everything is auto-configured by spring-boot-starter-data-redis module
The entity:
@Data@NoArgsConstructor@RedisHashpublic class ValidatedPhone { @Id private String phoneNumber; @Indexed private int profileId; @TimeToLive private long timeToLive;}
The repository:
public interface ValidatedPhoneRepository extends CrudRepository<ValidatedPhone, String> {}
The configuration:
@Configuration@ConditionalOnProperty(prefix = "redis", name = "enabled", havingValue = "true")@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)public class RedisConfiguration {}
Properties file:
spring: data: redis: host: ${redis.server.url} username: ${redis.server.user} password: ${redis.server.password} ssl: enabled: true
Locally, with Redis 6.2, everything works fine. The problem happens when the project is deployed to AWS Cloud with AWS Elasticache Redis.
The exception
Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command
CONFIG
, with args beginning with:GET
,notify-keyspace-events
Probably AWS Redis has some restrictions for executing the CONFIG command.
My by I need some custom redis configuration to avoid calling CONFIG command? Or my be some other solution?