Hyowon Yang b0b0ba3263 배치서비스개발, redis설정
- Analytics 5분 단위 배치 스케줄러 추가
- 초기 데이터 로딩 기능 구현 (서버 시작 30초 후)
- Redis 설정 업데이트 (외부 Redis 서버 연결)
- Redis 읽기 전용 오류 처리 추가
- IntelliJ 실행 프로파일 생성
- @EnableScheduling 활성화

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 13:39:10 +09:00

146 lines
3.7 KiB
YAML

spring:
application:
name: analytics-service
# Database
datasource:
url: jdbc:${DB_KIND:postgresql}://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:analytics_db}
username: ${DB_USERNAME:analytics_user}
password: ${DB_PASSWORD:analytics_pass}
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 20
minimum-idle: 5
connection-timeout: 30000
idle-timeout: 600000
max-lifetime: 1800000
leak-detection-threshold: 60000
# JPA
jpa:
show-sql: ${SHOW_SQL:true}
properties:
hibernate:
format_sql: true
use_sql_comments: true
hibernate:
ddl-auto: ${DDL_AUTO:update}
# Redis
data:
redis:
host: ${REDIS_HOST:20.214.210.71}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:Hi5Jessica!}
timeout: 2000ms
lettuce:
pool:
max-active: 8
max-idle: 8
min-idle: 0
max-wait: -1ms
database: ${REDIS_DATABASE:5}
# Kafka
kafka:
enabled: ${KAFKA_ENABLED:false}
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:4.230.50.63:9092}
consumer:
group-id: ${KAFKA_CONSUMER_GROUP_ID:analytics-service}
auto-offset-reset: earliest
enable-auto-commit: true
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
connections.max.idle.ms: 10000
request.timeout.ms: 5000
session.timeout.ms: 10000
# Server
server:
port: ${SERVER_PORT:8086}
# JWT
jwt:
secret: ${JWT_SECRET:}
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:1800}
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:86400}
# CORS Configuration
cors:
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:*}
# Actuator
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus
base-path: /actuator
endpoint:
health:
show-details: always
show-components: always
health:
livenessState:
enabled: true
readinessState:
enabled: true
# OpenAPI Documentation
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
operations-sorter: alpha
show-actuator: false
# Logging
logging:
level:
com.kt.event.analytics: ${LOG_LEVEL_APP:DEBUG}
org.springframework.web: ${LOG_LEVEL_WEB:INFO}
org.hibernate.SQL: ${LOG_LEVEL_SQL:DEBUG}
org.hibernate.type: ${LOG_LEVEL_SQL_TYPE:TRACE}
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
file:
name: ${LOG_FILE:logs/analytics-service.log}
logback:
rollingpolicy:
max-file-size: 10MB
max-history: 7
total-size-cap: 100MB
# Resilience4j Circuit Breaker
resilience4j:
circuitbreaker:
instances:
wooriTV:
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
sliding-window-size: 10
permitted-number-of-calls-in-half-open-state: 3
genieTV:
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
sliding-window-size: 10
ringoBiz:
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
sliding-window-size: 10
sns:
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
sliding-window-size: 10
# Batch Scheduler
batch:
analytics:
refresh-interval: ${BATCH_REFRESH_INTERVAL:300000} # 5분 (밀리초)
initial-delay: ${BATCH_INITIAL_DELAY:30000} # 30초 (밀리초)
enabled: ${BATCH_ENABLED:true} # 배치 활성화 여부