Example for Spring cloud (netflix OSS, spring cloud)
μ΄ νλ‘μ νΈλ μλμ κ°μ μμλ₯Ό ν¬ν¨νκ³ μμ΅λλ€
- eureka-server (λμ€μ»€λ²λ¦¬ μλΉμ€)
- 3κ°μ peer-to-peer λμ€μ»€λ²λ¦¬ μλ²
- κ° μλ²λ -Dspring.profiles.active=peer1 or peer2 or peer3 μ΅μ μ ν΅ν΄ ꡬλνμ¬μΌ ν©λλ€.
- μ¬μ©νλ ν¬νΈλ 8800-8802 μ λλ€. κ° μλ²λ μνλ₯Ό νμΈν μ μλ λμ보λλ₯Ό ν¬ν¨ν©λλ€.
- eureka-client (κ°λ¨ν λ°±μλ)
- 3κ°μ eureka-client μλΉμ€
- κ° μλ²λ -Dspring.profiles.active=peer1 or peer2 or peer3 μ΅μ μ ν΅ν΄ ꡬλνμ¬μΌ ν©λλ€.
- μ¬μ©νλ ν¬νΈλ 8811-8813 μ λλ€.
- κ΅¬μ± μ 보μ λν΄μ config-first-bootstrap μΌλ‘ ꡬνλμ΄ μμ΅λλ€.
- eureka-client-2 (κ°λ¨ν λ°±μλ)
- 3κ°μ eureka-client μλΉμ€
- κ° μλ²λ -Dspring.profiles.active=peer1 or peer2 or peer3 μ΅μ μ ν΅ν΄ ꡬλνμ¬μΌ ν©λλ€.
- μ¬μ©νλ ν¬νΈλ 8821-8823 μ λλ€.
- κ΅¬μ± μ 보μ λν΄μ discovery-first-bootstrap μΌλ‘ ꡬνλμ΄ μμ΅λλ€.
- zuul-gateway (API Gateway)
- ν¬νΈλ 8888 μ λλ€.
- http://localhost:8888/api/client/ping λ‘ μμ²μ μ μ‘νλ©΄ λ‘λλ°Έλ°μ±μ΄ μ μ©λ eureka-client λ°±μλ νΈμΆ μλ΅μ 보μ¬μ€λλ€.
- POST http://localhost:8888/actuator/refresh μ ν΅ν΄ μ격μ μ€μ μ κ°±μ ν μ μμ΅λλ€.
- hystrix-dashboard λ° turbine streamμ΄ μ΄ νλ‘μ νΈμ ν΅ν©λμ΄ μμ΅λλ€.
- API Gatewayλ‘ GET http://localhost:8888/api/client/userList μμ²μ ν΅ν΄ client -> client-2 λ‘ ribbon μ ν΅ν μμ²μ λ λ¦¬κ³ hystrix λ₯Ό ν΅ν fallback μ΄ λμν©λλ€.
- http://localhost:8888/ μμ http://localhost:8888/turbine.stream μ μ λ ₯ν΄ turbine.stream μ ν΅ν΄ μ 체 λμ€μ»€λ²λ¦¬μ hystrix metricμ μκ°ν ν μ μμ΅λλ€.
- spring-config-server (νμΌ κΈ°λ° μ격 컨νΌκ·Έ μλ²)
- /src/main/resources/config λλ ν 리 μμ μμ λͺ¨λ μλΉμ€μ λν config νμΌμ΄ μμΉν©λλ€.
- νμΌ κΈ°λ° κ΅¬λμ μν΄ -Dspring.profiles.active=native VM args λ‘ μ€ννμ¬μΌ ν©λλ€.
- ν¬νΈλ 9000μ μ¬μ©ν©λλ€.
- admin-server (spring-boot-admin)
- http://localhost:9900 μΌλ‘ spring-boot-admin-serverλ₯Ό νμΈν μ μμ΅λλ€.
- Discoveryλ₯Ό κΈ°λ°μΌλ‘ instanceλ₯Ό μλ³ν©λλ€.