From 3b170696ff5fd9b47015146e06382c6ca2ce0555 Mon Sep 17 00:00:00 2001 From: fnzl54 Date: Thu, 12 Oct 2023 13:52:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20docker=20=ED=99=98=EA=B2=BD=EC=97=90?= =?UTF-8?q?=EC=84=9C=20redis=20=EC=82=AC=EC=9A=A9=EA=B0=80=EB=8A=A5=20?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 93 ++++++++++--------- .../checkIt/global/config/RedisInfo.java | 20 ---- .../global/config/RedisRepositoryConfig.java | 18 ++-- 3 files changed, 63 insertions(+), 68 deletions(-) delete mode 100644 src/main/java/com/techeer/checkIt/global/config/RedisInfo.java diff --git a/docker-compose.yml b/docker-compose.yml index be169b2..dba0961 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,51 +1,51 @@ version: "3" services: -# mysql: -# container_name: mysql -# image: mysql:latest -# environment: -# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} -# MYSQL_USER: ${MYSQL_USER} -# MYSQL_PASSWORD: ${MYSQL_PASSWORD} -# MYSQL_DATABASE: ${MYSQL_DATABASE} -# volumes: -# - ./data:/var/lib/mysql -# command: -# - '--character-set-server=utf8mb4' -# - '--collation-server=utf8mb4_unicode_ci' -# ports: -# - "3307:3306" -# networks: -# - default_bridge + # mysql: + # container_name: mysql + # image: mysql:latest + # environment: + # MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + # MYSQL_USER: ${MYSQL_USER} + # MYSQL_PASSWORD: ${MYSQL_PASSWORD} + # MYSQL_DATABASE: ${MYSQL_DATABASE} + # volumes: + # - ./data:/var/lib/mysql + # command: + # - '--character-set-server=utf8mb4' + # - '--collation-server=utf8mb4_unicode_ci' + # ports: + # - "3307:3306" + # networks: + # - default_bridge backend: container_name: backend image: ${SPRING_BOOT_IMAGE} ports: - "8080:8080" -# environment: -# SPRING_DATASOURCE_URL: ${MYSQL_URL} -# SPRING_DATASOURCE_USERNAME: ${MYSQL_USER} -# SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD} -# SPRING_JPA_HIBERNATE_DDL_AUTO: update -# depends_on: -# - mysql + # environment: + # SPRING_DATASOURCE_URL: ${MYSQL_URL} + # SPRING_DATASOURCE_USERNAME: ${MYSQL_USER} + # SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD} + # SPRING_JPA_HIBERNATE_DDL_AUTO: update + # depends_on: + # - mysql networks: default_bridge: ipv4_address: 172.16.1.5 -# redis: -# container_name: redis -# image: redis:latest -# ports: -# - 6379:6379 -# volumes: -# - ./redis/data:/data -# labels: -# - "name=redis" -# - "mode=standalone" -# restart: always -# command: redis-server + # redis: + # container_name: redis + # image: redis:latest + # ports: + # - 6379:6379 + # volumes: + # - ./redis/data:/data + # labels: + # - "name=redis" + # - "mode=standalone" + # restart: always + # command: redis-server redis-master-1: container_name: redis-master-1 @@ -60,52 +60,61 @@ services: - 7101:7101 - 7102:7102 - 7103:7103 + networks: + - default_bridge redis-master-2: - network_mode: "service:redis-master-1" container_name: redis-master-2 image: redis volumes: - ./redis/config/redis-master-2.conf:/etc/redis.conf command: redis-server /etc/redis.conf + networks: + - default_bridge redis-master-3: - network_mode: "service:redis-master-1" container_name: redis-master-3 image: redis volumes: - ./redis/config/redis-master-3.conf:/etc/redis.conf command: redis-server /etc/redis.conf + networks: + - default_bridge redis-slave-1: - network_mode: "service:redis-master-1" container_name: redis-slave-1 image: redis volumes: - ./redis/config/redis-slave-1.conf:/etc/redis.conf command: redis-server /etc/redis.conf + networks: + - default_bridge redis-slave-2: - network_mode: "service:redis-master-1" container_name: redis-slave-2 image: redis volumes: - ./redis/config/redis-slave-2.conf:/etc/redis.conf command: redis-server /etc/redis.conf + networks: + - default_bridge redis-slave-3: - network_mode: "service:redis-master-1" container_name: redis-slave-3 image: redis volumes: - ./redis/config/redis-slave-3.conf:/etc/redis.conf command: redis-server /etc/redis.conf + networks: + - default_bridge redis-cluster-entry: network_mode: "service:redis-master-1" image: redis container_name: redis-cluster - command: redis-cli --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7101 127.0.0.1:7102 127.0.0.1:7103 --cluster-replicas 1 --cluster-yes + command: redis-cli --cluster create redis-master-1:7001 redis-master-2:7002 redis-master-3:7003 redis-slave-1:7101 redis-slave-2:7102 redis-slave-3:7103 --cluster-replicas 1 --cluster-yes + networks: + - default_bridge depends_on: - redis-master-1 - redis-master-2 diff --git a/src/main/java/com/techeer/checkIt/global/config/RedisInfo.java b/src/main/java/com/techeer/checkIt/global/config/RedisInfo.java deleted file mode 100644 index 008b39a..0000000 --- a/src/main/java/com/techeer/checkIt/global/config/RedisInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.techeer.checkIt.global.config; - -import java.util.List; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Getter -@Setter -@NoArgsConstructor -@ConfigurationProperties(prefix = "redis") // 설정 값을 불러올 때 prefix 값을 지정할 수 있다. -@Configuration -public class RedisInfo { - private String host; - private int port; - private RedisInfo master; - private List slaves; -} diff --git a/src/main/java/com/techeer/checkIt/global/config/RedisRepositoryConfig.java b/src/main/java/com/techeer/checkIt/global/config/RedisRepositoryConfig.java index f6c32d2..3c05184 100644 --- a/src/main/java/com/techeer/checkIt/global/config/RedisRepositoryConfig.java +++ b/src/main/java/com/techeer/checkIt/global/config/RedisRepositoryConfig.java @@ -23,12 +23,18 @@ public class RedisRepositoryConfig { @Bean public RedisConnectionFactory redisConnectionFactory() { RedisClusterConfiguration clusterConfig = new RedisClusterConfiguration(); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7001)); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7002)); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7003)); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7101)); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7102)); - clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7103)); + clusterConfig.addClusterNode(new RedisNode("redis-master-1", 7001)); + clusterConfig.addClusterNode(new RedisNode("redis-master-2", 7002)); + clusterConfig.addClusterNode(new RedisNode("redis-master-3", 7003)); + clusterConfig.addClusterNode(new RedisNode("redis-slave-1", 7101)); + clusterConfig.addClusterNode(new RedisNode("redis-slave-2", 7102)); + clusterConfig.addClusterNode(new RedisNode("redis-slave-3", 7103)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7001)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7002)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7003)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7101)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7102)); +// clusterConfig.addClusterNode(new RedisNode("127.0.0.1", 7103)); return new LettuceConnectionFactory(clusterConfig); } From d9fa3ee33a8a3025c3b71d7c8bc29b7586beac83 Mon Sep 17 00:00:00 2001 From: fnzl54 Date: Thu, 12 Oct 2023 14:00:15 +0900 Subject: [PATCH 2/2] chore: update security submodule --- src/main/resources/security | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/security b/src/main/resources/security index 60f7214..3c68f0b 160000 --- a/src/main/resources/security +++ b/src/main/resources/security @@ -1 +1 @@ -Subproject commit 60f7214407bcc48a94f3b61b635a0380669e2445 +Subproject commit 3c68f0b0bb333d08402d0133b6ff064f12dae6c1