개발이야기/DataBase
redisson 아직은...
대머리개발자
2024. 2. 1. 16:33
728x90
모듈별 디펜더시가 없으면 좋긴 하지만 너무 쪼개면 관리가 포인트가 그 만큼 늘어나서...지친다. ㅋ
적당히 MSA 하자
각각의 모듈에서 레디스를 직접 호출하는 것보다는 일렬종대 헤쳐모아를 위해서 작업을 진행했다.
인증서버는
implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
레디스 서버는
implementation 'org.redisson:redisson-spring-boot-starter:3.19.3'
인증서버에서 박아 넣은 데이터를 레디서 서버에서 꺼내려고 보니깐. 띠로링..
com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 121
at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:159) ~[kryo-5.4.0.jar:na]
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:758) ~[kryo-5.4.0.jar:na]
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:869) ~[kryo-5.4.0.jar:na]
at org.redisson.codec.Kryo5Codec$4.decode(Kryo5Codec.java:144) ~[redisson-3.19.3.jar:3.19.3]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:393) ~[redisson-3.19.3.jar:3.19.3]
at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:205) ~[redisson-3.19.3.jar:3.19.3]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:144) ~[redisson-3.19.3.jar:3.19.3]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:120) ~[redisson-3.19.3.jar:3.19.3]
레디손을 사용했던 이유는 선착순 이벤트를 위한 분산락을 위함이였다.
어떻게든 해볼라고!! AI한테도 질문을 던졌는데

내가 테스트하고 알려줬다. ㅋ
일단 둘다 설정해서 사용하자... 선착순을 이용할 때는 redisson을 사용하고 그 외는 Spring 진영에서 제공해주는 라이브러리를 이용한다.
레거시 인증서버를 레디손으로 마이그 하기가 빡시다 ㅜㅜ
@Configuration
class RedisConfig @Autowired constructor(
reactiveRedisOperations: ReactiveRedisOperations<String, String>,
redissonReactiveClient: RedissonReactiveClient
) {
init {
setRedis(reactiveRedisOperations)
setRedisson(redissonReactiveClient)
}
companion object{
....
}
728x90