导入pom文件
编写配置文件(port name defaultZone 端口号相互指向)
编写启动类(@EnableEurekaServer//开启eureka服务端的注解
高可用的第一个配置文件
server:
port: 8761
spring:
application:
name: eurekaServer
eureka:
server:
enable-self-preservation: false #关闭自我保护
eviction-interval-timer-in-ms: 5000
client:
register-with-eureka: true #该注册中心不像其它注册中心注册服务
fetch-registry: true #不从其它注册中心拉取服务 注意:默认开启集群,当部署单节点的时候,则将以上两项配置改为false
service-url:
defaultZone: http://localhost:8762/eureka
高可用的第一个配置文件
server:
port: 8762
spring:
application:
name: eurekaServer
eureka:
server:
enable-self-preservation: false
eviction-interval-timer-in-ms: 5000
client:
service-url:
defaultZone: http://localhost:8761/eureka
测试地址:http://localhost:8761/ http://localhost:8762/
测试结果:
http://localhost:8761/
http://localhost:8762/