搭建Eureka集群
配置host文件C:\Windows\System32\drivers\etc\hosts文件,添加映射
127.0.0.1 eureka-server1
127.0.0.1 eureka-server2
127.0.0.1 eureka-server3
2.2.1 application.yml配置
第1台application.yml:
server:
port: 8761
eureka:
instance:
hostname: eureka-server1
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://eureka-server2:8762/eureka/,http://eureka-server3:8763/eureka/
第2台application.yml
server:
port: 8762
eureka:
instance:
hostname: eureka-server2
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://eureka-server1:8761/eureka/,http://eureka-server3:8763/eureka/
第3台application.yml配置:
server:
port: 8763
eureka:
instance:
hostname: eureka-server3
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://eureka