본문 바로가기
spring

[Spring Boot] RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events'

by moonsiri 2023. 5. 19.
728x90
반응형
io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events' 
...
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events' 
...
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/boot/autoconfigure/session/RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events'
...

 

@EnableRedisHttpSession을 사용하는 경우 AutoConfiguration으로 RedisIndexedSessionRepository를 생성하여 사용합니다.

RedisIndexedSessionRepository는 {redisNamespace}:index:org.springframework.session.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME:collenkim:{username} 이라는 Set을 만드는 데, 해당 Set에서 member를 삭제하려면 SessionDestroyedEvent를 수신받아야합니다.

 ConfigureRedisAction.NO_OP을 Bean으로 추가하면 Redis config의 notify-keyspace-events에 SessionDestroyedEvent를 설정하지 않습니다.

@Bean
public ConfigureRedisAction configureRedisAction() {
	return ConfigureRedisAction.NO_OP;
}

 

 

notifiy-keyspace-events 활성화 방법은 아래 포스팅에서 확인해주세요.

 

 

[SpringBoot] Redis Key Expired Event Notification

Redis에서 만료된 키를 수신하거나 subscribe 하는 방법을 알아보다가 Redis에서 알림 이벤트를 발견하였습니다. 만료된 키에 대한 Redis Keyspace 알림에 대해 알아보겠습니다. 우선 redis.conf를 사용하여

moonsiri.tistory.com

 

728x90
반응형

댓글