註冊中心:spring
debug: true spring: application: name: eureka-server logging: level: com.netflix.eureka: 'off' com.netflix.discovery: 'off' --- spring: profiles: manager1 server: port: 8100 eureka: instance: prefer-ip-address: true #以IP地址註冊到服務中心,相互註冊使用IP地址 #ip-address: 192.168.1.1 #強制指定IP地址,默認會獲取本機的IP地址 client: service-url: defaultZone: http://192.168.1.2:8100/eureka/,http://192.168.1.3:8100/eureka/ --- spring: profiles: manager2 server: port: 8100 eureka: instance: prefer-ip-address: true client: service-url: defaultZone: http://192.168.1.1:8100/eureka/,http://192.168.1.3:8100/eureka/ --- spring: profiles: manager3 server: port: 8100 eureka: instance: prefer-ip-address: true client: service-url: defaultZone: http://192.168.1.1:8100/eureka/,http://192.168.1.2:8100/eureka/
微服務端:app
debug: true spring: application: name: eureka-client server: port: 8110 eureka: instance: prefer-ip-address: true #以IP地址註冊到服務中心 #instance-id: http://192.168.1.4:8110 #服務中心的信息顯示(若是IP地址不顯示的話,進行配置) client: service-url: defaultZone: http://192.168.1.1:8100/eureka/,http://192.168.1.2:8100/eureka/,http://192.168.1.3:8100/eureka/