集群

服务端

spring:
  application:
    name: eureka-server
eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8091/eureka,
        http://localhost:8092/eureka, http://localhost:8093/eureka

---
server:
  port: 8091
spring:
  profiles: peer1

---
server:
  port: 8092
spring:
  profiles: peer2

---
server:
  port: 8093
spring:
  profiles: peer3

通过设定 spring.profiles.active 参数启动三个 eureka 服务端构成一个三节点的集群。

客户端

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8091/eureka,
        http://localhost:8092/eureka, http://localhost:8093/eureka

Last updated