티스토리 뷰
@Configuration
public class RedisConfig {
@Value("${redis.cluster.nodes}")
List<String> redisNodeList;
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setConnectionFactory(connectionFactory);
return redisTemplate;
}
@Bean
public RedisConnectionFactory prdRedisConnectionFactory() {
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration(redisNodeList);
// topology 자동 업데이트 옵션 추가
// enablePeriodicRefresh(topology 정보 감시 주기) default value : 60s
ClusterTopologyRefreshOptions clusterTopologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
.enableAllAdaptiveRefreshTriggers() // MOVED, ASK, PERSISTENT_RECONNECTS, UNCOVERED_SLOT, UNKOWN_NODE trigger시 refresh 수행
.enablePeriodicRefresh(Duration.ofMinutes(30L)) // topology 정보 감시 주기 설정 -> 30분
.build();
ClientOptions clientOptions = ClusterClientOptions.builder()
.topologyRefreshOptions(clusterTopologyRefreshOptions)
.build();
// topology 옵션 및 timeout 세팅
LettuceClientConfiguration clientConfigurations = LettuceClientConfiguration.builder()
.commandTimeout(Duration.ofSeconds(30L)) // command Timeout설정 -> 30초
.clientOptions(clientOptions)
.build();
return new LettuceConnectionFactory(redisClusterConfiguration, clientConfigurations);
}
@Bean
public ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
}
'Skill > spring' 카테고리의 다른 글
ServiceConfig.java (0) | 2025.01.13 |
---|---|
ServiceAOP.java (0) | 2025.01.13 |
PropertiesCheck.java (0) | 2025.01.13 |
JasyptConfig.java (0) | 2025.01.13 |
AsyncConfig.java (0) | 2025.01.13 |
- Total
- Today
- Yesterday
- 여러 컬럼 update
- ul li로 테이블
- getter
- 정규식
- Javascript
- $.each
- border-collapse
- $.extend
- spring
- lombok
- oracle
- springboot
- @ExceptionHandler
- excel
- element위치
- setter
- devtools
- 전후방탐색
- object key
- CSS
- Keycode
- DatePicker
- PostgreSQL
- caniuse
- JQuery
- draw.io
- 프로젝트명변경
- QueryDSL
- 진열사랑
- sumifs
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |