설정

redis-cluster
	- node1
		- conf
			- redis.conf
	- docker-compose.yml
spring:
  profiles:
    active: dev  # 기본 프로파일을 dev로 설정 (필요에 따라 prod로 변경 가능)

#  datasource:
#    url: jdbc:mysql://localhost:3306/hanasi_db?useSSL=false&serverTimezone=UTC
#    username: root
#    password: 375632
#    driver-class-name: com.mysql.cj.jdbc.Driver

#  jpa:
#    hibernate:
#      ddl-auto: none
#    show-sql: true
#    properties:
#      hibernate:
#        format_sql: true

# dev 프로파일에 대한 설정 (H2 사용)
---
spring:
  config:
    activate:
      on-profile: dev  # 변경된 속성명 사용

  datasource:
    url: jdbc:h2:mem:testdb  # H2 인메모리 데이터베이스
    driver-class-name: org.h2.Driver
    username: sa
    password:

  h2:
    console:
      enabled: true  # H2 콘솔 활성화 (<http://localhost:8080/h2-console>)

  jpa:
    hibernate:
      ddl-auto: create
    show-sql: true
    properties:
      hibernate:
        format_sql: true
  data:
    redis:
#      host: localhost
#      port: 6379
      cluster:
        nodes:
          - host.docker.internal:7001
          - host.docker.internal:7002
          - host.docker.internal:7003
#          - 192.168.35.47:7001
#          - 192.168.35.47:7002
#          - 192.168.35.47:7003
#          - 192.168.35.47:7004
#          - 192.168.35.47:7005
#          - 192.168.35.47:7006
#      timeout: 2000
#      lettuce:
#        pool:
#          max-active: 50
#          max-idle: 10
#          min-idle: 2
#          time-between-eviction-runs: 1s

management:
  endpoints:
    web:
      exposure:
        include: "*"
  prometheus:
    metrics:
      export:
        enabled: true
  endpoint:
    prometheus:
      enabled: true

logging:
  level:
    root: INFO
    org.springframework.web: WARN
    com.neon.hanasi: DEBUG

# prod 프로파일에 대한 설정 (MySQL 사용)
---
spring:
  config:
    activate:
      on-profile: prod  # 변경된 속성명 사용

  datasource:
    url: jdbc:mysql://localhost:3306/hanasi_db?useSSL=false&serverTimezone=UTC
    username: root
    password: 375632
    driver-class-name: com.mysql.cj.jdbc.Driver

  jpa:
    hibernate:
      ddl-auto: none
    show-sql: true
    properties:
      hibernate:
        format_sql: true

logging:
  level:
    root: WARN
    org.springframework.web: WARN
    com.neon.hanasi: WARN

Redis 2개로 클러스터 형성하기 (하면 pub/sub 못씀)

Redis 에러모음

I'm sorry to hear that you're experiencing issues. Let me provide you with a comprehensive, step-by-step guide to set up a Redis Cluster using Docker Compose for use in a Spring Boot project. I will include all necessary code and commands to ensure that you can follow along without any problems.

Step-by-Step Guide to Setting Up a Redis Cluster with Docker Compose

Overview

We will set up a Redis Cluster with six nodes (three masters and three replicas) using Docker Compose. We will configure the cluster so that it can be accessed from your Spring Boot application running on the host machine.

Prerequisites

Step 1: Create a Project Directory

Create a directory for your Redis Cluster setup and navigate into it.

mkdir redis-cluster
cd redis-cluster