fix: redis standalone 모드로 변경

This commit is contained in:
djeon 2025-10-26 10:08:38 +09:00
parent d515d14350
commit 3f20f19f44
2 changed files with 1988 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
package com.unicorn.hgzero.meeting.infra.config;
import io.lettuce.core.ClientOptions;
import io.lettuce.core.ReadFrom;
import io.lettuce.core.SocketOptions;
import io.lettuce.core.TimeoutOptions;
import lombok.extern.slf4j.Slf4j;
@ -19,10 +18,10 @@ import java.time.Duration;
/**
* Redis 설정
* Master-Replica 구조에서 읽기/쓰기 분리 지원
* Standalone 모드로 연결
*
* ReadFrom.MASTER 설정으로 모든 읽기/쓰기를 Master에서 수행
* Replica 연결 자동으로 Master로 리다이렉트 시도
* - ReadFrom 설정 제거: Master-Replica 자동 탐색 비활성화
* - 로컬 개발 환경에서 Kubernetes 내부 DNS 해석 오류 방지
*/
@Configuration
@Slf4j
@ -42,7 +41,7 @@ public class RedisConfig {
/**
* Lettuce 클라이언트 설정
* - ReadFrom.MASTER: 모든 읽기/쓰기를 Master에서 수행
* - Standalone 모드: ReadFrom 설정 제거로 Master-Replica 자동 탐색 비활성화
* - AutoReconnect: 연결 끊김 자동 재연결
* - DisconnectedBehavior.REJECT_COMMANDS: 연결 끊김 명령 거부
*/
@ -69,14 +68,13 @@ public class RedisConfig {
.build();
// Lettuce 클라이언트 설정
// ReadFrom.MASTER: 모든 작업을 Master에서 수행
// ReadFrom 설정 제거: Standalone 모드로 동작, Master-Replica 자동 탐색 비활성화
LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder()
.clientOptions(clientOptions)
.readFrom(ReadFrom.MASTER) // 모든 읽기/쓰기를 Master에서 수행
.commandTimeout(Duration.ofSeconds(10))
.build();
log.info("Redis Lettuce Client 설정 완료 - ReadFrom: MASTER (모든 작업 Master에서 수행)");
log.info("Redis Lettuce Client 설정 완료 - Standalone 모드 (Master-Replica 자동 탐색 비활성화)");
return clientConfig;
}