单机两节点
application.properties(1):
#各节点需一致
spring.application.name=eureka-server
server.port=8761
eureka.instance.hostname=eureka1
eureka.client.serviceUrl.defaultZone=http://eureka2:8762/eureka/
#已下三项为默认配置
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true
eureka.instance.prefer-ip-address=false
application.properties(2):
spring.application.name=eureka-server
server.port=8762
eureka.instance.hostname=eureka2
eureka.client.serviceUrl.defaultZone=http://eureka1:8761/eureka/
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true
eureka.instance.prefer-ip-address=false
host文件添加:
127.0.0.1 eureka1
127.0.0.1 eureka2