一、说明
上一篇文章对 eureka server 进行了集群化,现在我们对 zuul 也来集群化
二、修改 zuul 的配置文件
application.yml
spring:
application:
name: zuul
profiles:
active: zuul1
新增 application-zuul1.yml
server:
port: 8769
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
cloud:
bus:
enabled: true
trace:
enabled: true
eureka:
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8760/eureka/
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
zuul:
routes:
toclient1:
path: /toclient1/**
serviceId: client1
toclient2:
path: /toclient2/**
serviceId: client2
新增 application-zuul2.yml
server:
port: 8770
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
cloud:
bus:
enabled: true
trace:
enabled: true
eureka:
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8760/eureka/
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
zuul:
routes:
toclient1:
path: /toclient1/**
serviceId: client1
toclient2:
path: /toclient2/**
serviceId: client2
指向 zuul1 启动一个 zuul,再指向 zuul2 启动一个
网友评论