eureka 配置运行

本机模拟eureka集群

1.配置系统主机映射文件

sudo vim /etc/hosts

 

添加配置

 127.0.0.1 server1

 127.0.0.1 server2

 127.0.0.1 server3

 

2.项目配置文件

spring:
application:
name: ad-eureka
profiles: server1
server:
port: 8000
eureka:
instance:
hostname: server1
prefer-ip-address: false
client:
service-url:
defaultZone: http://server2:8001/eureka/,http://server3:8002/eureka/

---
spring:
application:
name: ad-eureka
profiles: server2
server:
port: 8001
eureka:
instance:
hostname: server2
prefer-ip-address: false
client:
service-url:
defaultZone: http://server1:8000/eureka/,http://server3:8002/eureka/

---
spring:
application:
name: ad-eureka
profiles: server3
server:
port: 8002
eureka:
instance:
hostname: server3
prefer-ip-address: false
client:
service-url:
defaultZone: http://server1:8000/eureka/,http://server2:8001/eureka/

 

转载于:https://www.cnblogs.com/flyyu1/p/10980401.html

你可能感兴趣的:(eureka 配置运行)