Register 注册中心 配置
server:
port: 8001
spring:
application:
name: Eureka-register
eureka:
instance:
hostname: peer1
client:
register-with-eureka: true
fetch-registry: true
instance-info-replication-interval-seconds: 30
serviceUrl:
# defaultZone: http://${eureka.instance.hostname}:${server.port}${server.servlet.context-path}/eureka/
defaultZone: http://peer2:8002/eureka/,http://peer3:8003/eureka/
provider 服务服务者 配置
server:
port: 8101
spring:
application:
name: Eureka-provider
eureka:
instance:
lease-renewal-interval-in-seconds: 20
client:
register-with-eureka: true
fetch-registry: true
instance-info-replication-interval-seconds: 30
registry-fetch-interval-seconds: 10
serviceUrl:
# defaultZone: http://localhost:8001/register/eureka/
defaultZone: http://peer1:8001/eureka/,http://peer2:8002/eureka/,http://peer3:8003/eureka/
consummer 消费者 配置
server:
port: 8201
spring:
application:
name: Eureka-consumer
eureka:
instance:
lease-renewal-interval-in-seconds: 10
lease-expiration-duration-in-seconds: 20
client:
register-with-eureka: true
fetch-registry: true
instance-info-replication-interval-seconds: 30
registry-fetch-interval-seconds: 10
serviceUrl:
# defaultZone: http://localhost:8001/register/eureka/
defaultZone: http://peer1:8001/eureka/,http://peer2:8002/eureka/,http://peer3:8003/eureka/
结构
完成效果
https://www.cnblogs.com/yansg/p/12560619.html