Backend/spring cloud (MSA)

Eureka๋ž€?

dddzr 2025. 2. 16. 21:57

๐Ÿ“Œ 1. Eureka๋ž€?

  • Eureka๋Š” Netflix์—์„œ ๊ฐœ๋ฐœํ•œ ์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ ๋„๊ตฌ 
  • ์„œ๋น„์Šค๋“ค์ด ๋™์ ์œผ๋กœ ๋“ฑ๋ก๋˜๊ณ  ์„œ๋น„์Šค ์œ„์น˜ ์ •๋ณด๋ฅผ ์ค‘์•™์—์„œ ๊ด€๋ฆฌ, Gateway์—์„œ ๊ฐ ์„œ๋น„์Šค์˜ uri๋ฅผ ์ง์ ‘ ์„ค์ •ํ•  ํ•„์š”์—†๋‹ค.

 

โœ… 1-1. Eureka์˜ ์ฃผ์š” ๊ฐœ๋…

1๏ธโƒฃ Eureka Server

  • Eureka Server๋Š” ์—ฌ๋Ÿฌ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค๋“ค์ด ์„œ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋„๋ก ์„œ๋น„์Šค ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ณ  ์ œ๊ณต.
  • ์—ฌ๋Ÿฌ ๊ฐœ์˜ Eureka ์„œ๋ฒ„๋ฅผ ํด๋Ÿฌ์Šคํ„ฐ๋งํ•˜์—ฌ ๊ณ ๊ฐ€์šฉ์„ฑ์„ ๋ณด์žฅํ•  ์ˆ˜ ์žˆ๋‹ค.

 

2๏ธโƒฃ Eureka Client ( ์„œ๋น„์Šค ๋“ฑ๋ก & ์„œ๋น„์Šค ๊ฒ€์ƒ‰ )

  • ์„œ๋น„์Šค๊ฐ€ Eureka Server์— ์ž์‹ ์„ ๋“ฑ๋กํ•˜๊ณ , ๋‹ค๋ฅธ ์„œ๋น„์Šค๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด Eureka Client๋ฅผ ์‚ฌ์šฉ.
  • ์ฃผ๊ธฐ์ ์œผ๋กœ ์ž์‹ ์ด ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” ํ˜ธ์ŠคํŠธ์™€ ํฌํŠธ๋ฅผ Eureka Server์— ์•Œ๋ฆฐ๋‹ค.
  • ํด๋ผ์ด์–ธํŠธ๋Š” Eureka Server์—์„œ ์ œ๊ณตํ•˜๋Š” ์„œ๋น„์Šค ๋ชฉ๋ก์„ ์กฐํšŒํ•˜๊ณ , ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•˜์—ฌ ํ†ต์‹ ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

โœ… 1-2. Eureka์˜ ์ฃผ์š” ์—ญํ• 

1๏ธโƒฃ ์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ (Service Discovery)

  • ํด๋ผ์ด์–ธํŠธ๋‚˜ ๋‹ค๋ฅธ ์„œ๋น„์Šค๊ฐ€ ์„œ๋น„์Šค๋ฅผ ์ฐพ์„ ๋•Œ, Eureka Server์—์„œ ์„œ๋น„์Šค ๋ชฉ๋ก์„ ์กฐํšŒํ•˜์—ฌ ํ•„์š”ํ•œ ์„œ๋น„์Šค์˜ ์œ„์น˜๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค.
  • ์ด ๋ฐฉ์‹์œผ๋กœ ์„œ๋น„์Šค๊ฐ€ ๋™์ ์œผ๋กœ ํ™•์žฅ๋˜๊ฑฐ๋‚˜ ์ถ•์†Œ๋˜์–ด๋„ ํด๋ผ์ด์–ธํŠธ๋Š” ์„œ๋น„์Šค์˜ ์‹ค์ œ ์œ„์น˜๋ฅผ ์•Œ ํ•„์š” ์—†์ด Eureka๋ฅผ ํ†ตํ•ด ์ž๋™์œผ๋กœ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค.

 

2๏ธโƒฃ ๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ ๋ฐ Fault Tolerance

  • Spring Cloud ํ”„๋กœ์ ํŠธ์—์„œ๋Š” Spring Cloud LoadBalancer๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ Eureka์™€ ์—ฐ๋™
  • ํด๋ผ์ด์–ธํŠธ(RestTemplate, WebClient, Feign)์—์„œ @LoadBalanced๋ฅผ ์“ฐ๋ฉด, Eureka์—์„œ ์ธ์Šคํ„ด์Šค ๋ชฉ๋ก ์กฐํšŒ → LoadBalancer๊ฐ€ Round-Robin, Random ๋“ฑ ์ „๋žต์œผ๋กœ ์„ ํƒ → ์š”์ฒญ ๋ถ„๋ฐฐ
  • ํŠน์ • ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค๊ฐ€ ์‘๋‹ตํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, Eureka๋Š” ์ด๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค๋ฅธ ์ธ์Šคํ„ด์Šค๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

 

3๏ธโƒฃ ์ƒํƒœ ๊ฐฑ์‹ (heartbeat ์ฒดํฌ) & ์ž์ฒด ๋ณต๊ตฌ ๊ธฐ๋Šฅ (Self-healing)

  • Eureka Client๋Š” ์ผ์ • ์ฃผ๊ธฐ๋กœ Heartbeat ์‹ ํ˜ธ๋ฅผ Eureka Server์— ๋ณด๋‚ด ์„œ๋น„์Šค ์ƒํƒœ๋ฅผ ๊ฐฑ์‹ ํ•œ๋‹ค.
  • Heartbeat ์‹ ํ˜ธ๋ฅผ ๋ฐ›์ง€ ๋ชปํ•œ ๊ฒฝ์šฐ Eureka Server๋Š” ํ•ด๋‹น ์„œ๋น„์Šค๋ฅผ DOWN ์ƒํƒœ๋กœ ํ‘œ์‹œ or ๋ชฉ๋ก์—์„œ ์ œ๊ฑฐ.
  • ์„œ๋น„์Šค๊ฐ€ ๋‹ค์‹œ ์‹œ์ž‘๋˜๋ฉด Eureka์— ๋‹ค์‹œ ๋“ฑ๋ก๋˜์–ด ์ž๋™์œผ๋กœ ๋ณต๊ตฌ๋œ๋‹ค.

 

โญ ์ธ์Šคํ„ด์Šค ์ƒํƒœ

  • ํ—ฌ์Šค์ฒดํฌ ์‹คํŒจ ์‹œ : status Down์œผ๋กœ ๋ณ€๊ฒฝ
  • ํ—ฌ์Šค์ฒดํฌ ์ผ์ •๊ธฐ๊ฐ„(leaseExpirationDurationInSeconds, ๊ธฐ๋ณธ 90์ดˆ) ๋™์•ˆ ์‹คํŒจ: ๋“ฑ๋ก ํ•ด์ œ
  • ๋น„ํ™œ์„ฑํ™”(๊ด€๋ฆฌ์ž ๋˜๋Š” ์‹œ์Šคํ…œ์ด ์„ค์ •): ์œ ์ง€๋ณด์ˆ˜ ๋“ฑ์˜ ์ด์œ ๋กœ ์ผ์‹œ์ ์œผ๋กœ ์ œ์™ธํ•˜๋Š” ๊ฒƒ, ์„œ๋น„์Šค๋Š” ์‹คํ–‰ ์ค‘ ์ด์ง€๋งŒ ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ์„ ๋ฐ›์ง€ ์•Š๋„๋ก ์„ค์ •๋จ.
์ƒํƒœ ์„ค๋ช… Eureka์— ๋“ฑ๋ก ์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ ์ž๋™ ๋ณต๊ตฌ
OUT_OF_SERVICE ์„œ๋น„์Šค๊ฐ€ ์ผ์‹œ์ ์œผ๋กœ ์‚ฌ์šฉ ์ค‘์ง€๋จ (๋ณดํ†ต ์ˆ˜๋™ ์„ค์ •) โœ… (๋“ฑ๋ก๋จ) โŒ (์กฐํšŒ ๋ถˆ๊ฐ€) โœ… (UP์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ์ฆ‰์‹œ ๋ณต๊ตฌ๋จ)
DOWN ์„œ๋น„์Šค๊ฐ€ ์žฅ์• ๋กœ ์ธํ•ด ๋™์ž‘ํ•˜์ง€ ์•Š์Œ โœ… (๋“ฑ๋ก๋จ) โŒ (์กฐํšŒ ๋ถˆ๊ฐ€) โœ… (UP์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ฑฐ๋‚˜ ํ—ฌ์Šค ์ฒดํฌ ๋ณต๊ตฌ ์‹œ ์ž๋™ ๋ณต๊ตฌ)
DEREGISTERED ์„œ๋น„์Šค๊ฐ€ ์™„์ „ํžˆ ์‚ญ์ œ๋จ โŒ (๋“ฑ๋ก ํ•ด์ œ๋จ) โŒ (์กฐํšŒ ๋ถˆ๊ฐ€) โŒ (์ƒˆ๋กญ๊ฒŒ ์žฌ๋“ฑ๋กํ•ด์•ผ ํ•จ)

 

๐Ÿ“Œ 2. ์„œ๋ฒ„ ์„ค์ • ๋ฐฉ๋ฒ•

โœ… 2-1. ์˜์กด์„ฑ ์ถ”๊ฐ€

๐Ÿ“– build.gradle

implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:2024.0.0"
    }
}

*๋ฒ„์ „ ์ฐธ๊ณ 

https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies

โœ… 2-2. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ค์ •

๐Ÿ“– application.properties

spring.application.name=eureka

# Eureka ์„œ๋ฒ„ ํฌํŠธ ์„ค์ •
server.port=8761

# Eureka ์„œ๋ฒ„ ์„ค์ •
 # ์ด ์„œ๋ฒ„๋Š” ๋‹ค๋ฅธ ์„œ๋ฒ„์— ๋“ฑ๋กํ•˜์ง€ ์•Š์Œ
eureka.client.registerWithEureka=false
 # ์ด ์„œ๋ฒ„๋Š” ๋‹ค๋ฅธ ์„œ๋ฒ„์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ์•Š์Œ
eureka.client.fetchRegistry=false
# ์„œ๋ฒ„ ์ž๊ธฐ ๋ณดํ˜ธ ๋ชจ๋“œ ๋น„ํ™œ์„ฑํ™”
eureka.server.enableSelfPreservation=false
# ์ด ์„ค์ •์„ ํ†ตํ•ด ๊ธฐ๋ณธ UI๋ฅผ ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Œ
management.endpoints.web.exposure.include=*

 

โœ… 2-3. @EnableEurekaServer ์ถ”๊ฐ€

๐Ÿ“– main class

package com.example.eureka;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class, args);
    }
}

 

๐Ÿ“Œ 3. Client ์„ค์ • ๋ฐฉ๋ฒ•

โœ… 3-1. ์˜์กด์„ฑ ์ถ”๊ฐ€

๐Ÿ“– build.gradle

//eureka
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

 

โœ… 3-2. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ค์ •

๐Ÿ“– application.properties

spring.application.name=gateway

# Spring Cloud Gateway ์„ค์ •

# ์„œ๋ฒ„ ํฌํŠธ ์„ค์ •
server.port=8080

# ๋ผ์šฐํŠธ ์„ค์ •
# Eureka ์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ์™€ ํ†ตํ•ฉ
# ๋“ฑ๋ก๋œ ์„œ๋น„์Šค ์ด๋ฆ„์„ ์‚ฌ์šฉํ•˜์—ฌ ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•ด ๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ์„ ์ˆ˜ํ–‰.
spring.cloud.gateway.routes[0].id=to_service1
spring.cloud.gateway.routes[0].uri=lb://SERVICE-1
spring.cloud.gateway.routes[0].predicates[0]=Path=/service1/**
spring.cloud.gateway.routes[0].filters[0]=AddRequestHeader=X-Gateway-Header, Gateway-Value

# Eureka ์„œ๋ฒ„ URL (Eureka์™€ ์—ฐ๋™ ์‹œ)
eureka.client.service-url.defaultZone=http://localhost:8761/eureka/

# Eureka ์„œ๋น„์Šค ๋“ฑ๋ก์„ ํ†ตํ•œ ๋™์  ๋ผ์šฐํŒ… ํ™œ์„ฑํ™”
spring.cloud.gateway.discovery.locator.enabled=true
# eureka server registry์— ํ˜„์žฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ž์‹ ์˜ ์ •๋ณด๋ฅผ ๋“ฑ๋กํ• ์ง€ (๋‹ค๋ฅธ ์„œ๋น„์Šค๋“ค์ด name์œผ๋กœ ์ ‘๊ทผ๊ฐ€๋Šฅ)
eureka.client.registerWithEureka=true
# registry์— ์žˆ๋Š” ์ •๋ณด(๋“ฑ๋ก๋œ ์„œ๋น„์Šค ๋ชฉ๋ก)๋“ค์„ ๊ฐ€์ ธ์˜ฌ์ง€ ์—ฌ๋ถ€
eureka.client.fetchRegistry=true
#Actuator ์—”๋“œํฌ์ธํŠธ ํ™œ์„ฑํ™” -> ์•ˆ ํ•ด๋„ ๋˜๋Š”๋ฐ ์œ ๋ ˆ์นด ์„œ๋ฒ„์—์„œ ์กฐํšŒํ•˜๋Š”๊ฒŒ ์žˆ์Œ.
management.endpoints.web.exposure.include=*

 

โœ… 3-3. @EnableDiscoveryClient์ถ”๊ฐ€ (์ตœ์‹  ๋ฒ„์ „์—์„œ ์ƒ๋žต ๊ฐ€๋Šฅ)

๐Ÿ“– main class

import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}

 

๐Ÿ“Œ 4. ์„œ๋น„์Šค ํ™•์ธ

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰ ํ›„ http://localhost:8761(์œ ๋ ˆ์นด ์„œ๋ฒ„ ํฌํŠธ) ๋กœ ์ ‘์†ํ•˜์—ฌ ๋“ฑ๋ก๋œ ์„œ๋น„์Šคํ™•์ธ ๊ฐ€๋Šฅ.

  • Instances ์—์„œ ๋“ฑ๋กํ•œ application์ด ์กฐํšŒ๋œ๋‹ค.
  • status๋งํฌ ํด๋ฆญ ์‹œ http://desktop-2lii5um:8080/actuator/info๋กœ ์ด๋™๋œ๋‹ค.

 

โœ… 4-1. System Status ์˜ต์…˜

๐Ÿ“– ์˜ต์…˜ ์˜ˆ์‹œ

ํ•ญ๋ชฉ ๊ฐ’
๋“ฑ๋ก๋œ ์„œ๋น„์Šค ์ˆ˜ 4๊ฐœ (GATEWAY, NOTE, SECURITY, USER)
๊ฐ ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค ์ˆ˜ 1๊ฐœ์”ฉ
Renews threshold 8
Renews (last min) 16
Lease expiration enabled true



๐Ÿ”นRenews threshold๋ž€?

Eureka๊ฐ€ “์ ์–ด๋„ ์ด ์ •๋„ ๊ฐฑ์‹ ์€ ์™€์•ผ ์ธ์Šคํ„ด์Šค๋“ค์ด ์ •์ƒ์ ์œผ๋กœ ์‚ด์•„์žˆ๊ตฌ๋‚˜” ํŒ๋‹จํ•˜๋Š” ๊ธฐ์ค€๊ฐ’. => ์ธ์Šคํ„ด์Šค ์ˆ˜ X ๋ถ„๋‹น ๊ธฐ๋Œ€๋˜๋Š” renewal ํšŸ์ˆ˜๋กœ ์ •ํ•ด์ง„๋‹ค.

 

๐Ÿ”น Renews (last min): 16 ์˜๋ฏธ๋Š”?

  • ์‹ค์ œ๋กœ Eureka๊ฐ€ ์ง€๋‚œ 1๋ถ„๊ฐ„ ๋ฐ›์€ ๊ฐฑ์‹ (heartbeat) ์š”์ฒญ ์ˆ˜
  • Eureka๋Š” ๋“ฑ๋ก๋œ ์ธ์Šคํ„ด์Šค ์ˆ˜ × 2 ๋งŒํผ์˜ renewal ์ด ๊ธฐ๋ณธ์ ์œผ๋กœ 1๋ถ„์— ์™€์•ผ ํ•œ๋‹ค๊ณ  ์˜ˆ์ƒ, ๊ธฐ๋ณธ renewal ๊ฐ„๊ฒฉ: 30์ดˆ๋งˆ๋‹ค ํ•œ ๋ฒˆ (default)
  • 16๋ฒˆ์ด๋ฉด ๊ฐ ์ธ์Šคํ„ด์Šค๊ฐ€ ์ •์ƒ์ ์œผ๋กœ 2๋ฒˆ์”ฉ heartbeat๋ฅผ ๋ณด๋‚ด๊ณ  ์žˆ๋‹ค๋Š” ๋œป! (4๊ฐœ × 2 = 8 × 2 = 16)
  • ๐Ÿ’ก renewal ์„ค์ • ๋ฐ”๊พธ๊ณ  ์‹ถ๋‹ค๋ฉด?
eureka:
  instance:
    lease-renewal-interval-in-seconds: 30     # ๊ธฐ๋ณธ๊ฐ’ (30์ดˆ๋งˆ๋‹ค ๊ฐฑ์‹ )
    lease-expiration-duration-in-seconds: 90  # ๊ฐฑ์‹ ์ด ์ด ์‹œ๊ฐ„ ์•ˆ์— ์—†์œผ๋ฉด DOWN ์ฒ˜๋ฆฌ

 



โœ… 4-2. โŒ ์—๋Ÿฌ: Invalid host: lb://{service_name}

โŒ ์—๋Ÿฌ: Invalid host: lb://{service_name}

[139c33b5] There was an unexpected error (type=Internal Server Error, status=500).
Invalid host: lb://product_service

2025-01-08T13:03:38.745+09:00 INFO 14960 --- [gateway] [nio-8080-exec-5] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x000xf70x010x000x000xf30x030x030x850x020xcc00x8f>6\0xb60xd2e0xc20xb10xe80xa40xe60x86js0x8fl%,0xa90xd10x1aU0xd0,"0xbb0xcc ]. HTTP method names must be tokens
//…
[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@1dde45af}, order = 2147483647]] 2025-01-08T13:04:00.262+09:00 ERROR 14960 --- [gateway] [nio-8080-exec-6] a.w.r.e.AbstractErrorWebExceptionHandler : [6b9f950f] 500 Server Error for HTTP GET "/product/api/products/all" java.lang.IllegalStateException: Invalid host: lb://product_service at

 

๐Ÿ›  ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

1. ์„œ๋น„์Šค ๋ช… ๋Œ€์‹  port ์ง์ ‘ ์„ค์ •

์ด๋ ‡๊ฒŒ ํ•˜๋‹ˆ๊นŒ ์ ‘์†๋จ. -> ์œ ๋ ˆ์นด ๋ฌธ์ œ์ธ ๊ฒƒ!!

spring.cloud.gateway.routes[1].uri=http://localhost:8083
# lb://product_service

 

2. ์„œ๋น„์Šค ๋ช… ์ˆ˜์ •

Eureka์— ๋“ฑ๋กํ•˜๋Š” ์„œ๋น„์Šค์— _์žˆ์œผ๋ฉด ์•ˆ๋œ๋‹ค๊ณ  ํ•œ๋‹ค. -๋กœ ์ˆ˜์ •ํ•˜๋‹ˆ๊นŒ ์ ‘์†๋จ.

spring.application.name=product-service

 

๐Ÿ“Œ 5. Eureka ๋ณด์•ˆ ์„ค์ •

โœ… 5-1. ๊ธฐ๋ณธ Eureka์˜ ๋ณด์•ˆ ์ทจ์•ฝ์ 

โš ๏ธ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ธ์ฆ/์ธ๊ฐ€ ์—†์ด ๋™์ž‘, ๋ˆ„๊ตฌ๋‚˜ ์ ‘๊ทผ ๊ฐ€๋Šฅ

  • http://<eureka-server>:8761/eureka/apps ๋กœ ์ง์ ‘ REST ํ˜ธ์ถœํ•ด์„œ ์„œ๋น„์Šค ๋“ฑ๋ก ๊ฐ€๋Šฅ
  • POST, PUT, DELETE ์š”์ฒญ์„ ๋‚ ๋ฆฌ๋ฉด ๋“ฑ๋ก/์ œ๊ฑฐ๋„ ๊ฐ€๋Šฅํ•จ

โœ…5-2. Eureka ๋ณด์•ˆ ๊ฐ•ํ™” ๋ฐฉ๋ฒ•๋“ค ๐Ÿ› 

1๏ธโƒฃ Spring Security ์—ฐ๋™ (๊ธฐ๋ณธ ์ธ์ฆ): Eureka ์„œ๋ฒ„์— ์ธ์ฆ์„ ์ถ”๊ฐ€

spring:
  security:
    user:
      name: admin
      password: admin

 

ํด๋ผ์ด์–ธํŠธ ์ชฝ์—์„œ eureka.client.service-url.defaultZone ์„ค์ •์— ์ธ์ฆ ์ •๋ณด๋ฅผ ํฌํ•จํ•ด์ค˜์•ผ ํ•œ๋‹ค.

eureka:
  client:
    service-url:
      defaultZone: http://admin:admin@<eureka-server-ip>:8761/eureka/

 

2๏ธโƒฃ ๋ฐฉํ™”๋ฒฝ/๋„คํŠธ์›Œํฌ ์ œํ•œ

  • ์ธํ”„๋ผ ๋ ˆ๋ฒจ์—์„œ IP ํ™”์ดํŠธ๋ฆฌ์ŠคํŠธ ๋ฐฉ์‹์œผ๋กœ Eureka ์ ‘๊ทผ ์ฐจ๋‹จ
  • ์‚ฌ๋‚ด๋ง ๋˜๋Š” VPN ๋‚ด๋ถ€์—์„œ๋งŒ ๋…ธ์ถœ

3๏ธโƒฃ HTTPS ์‚ฌ์šฉ

  • SSL ์ธ์ฆ์„œ๋ฅผ ๋ถ™์—ฌ์„œ ํ†ต์‹ ์„ ์•”ํ˜ธํ™” (์ค‘๊ฐ„์ž ๊ณต๊ฒฉ ๋ฐฉ์ง€)

4๏ธโƒฃ ์„œ๋น„์Šค ๋“ฑ๋ก์šฉ ํ† ํฐ/ํ•„ํ„ฐ ๊ตฌํ˜„ (์ปค์Šคํ„ฐ๋งˆ์ด์ง•)

  • ์ง์ ‘ Eureka ์„œ๋ฒ„์— Filter ๋˜๋Š” Interceptor๋ฅผ ๋ถ™์—ฌ์„œ ๋“ฑ๋ก ์š”์ฒญ ์‹œ ํ† ํฐ ๊ฒ€์ฆ ๋“ฑ ์ถ”๊ฐ€ ๊ฐ€๋Šฅ

 

'Backend > spring cloud (MSA)' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

MSA ํ™˜๊ฒฝ์—์„œ ์ธ์ฆ/ํ† ํฐ ์žฌ์š”์ฒญ  (0) 2025.04.06
์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ์ „์†ก  (0) 2025.02.23
Kafka๋ž€?  (0) 2025.02.23
GateWay๋ž€?  (0) 2025.02.16
Spring Cloud๋ž€?  (0) 2025.02.16