diff --git a/ms/cms/src/main/resources/bootstrap.yml b/ms/cms/src/main/resources/bootstrap.yml index 29b7e9f..e70f871 100644 --- a/ms/cms/src/main/resources/bootstrap.yml +++ b/ms/cms/src/main/resources/bootstrap.yml @@ -5,4 +5,10 @@ spring: uri: http://127.0.0.1:9999/ profile: dev label: master - name: cms \ No newline at end of file + name: cms +eureka: + client: + serviceUrl: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + instance: + hostname: www.cms.com \ No newline at end of file diff --git a/ms/config-server/pom.xml b/ms/config-server/pom.xml index af7fa24..27bce32 100644 --- a/ms/config-server/pom.xml +++ b/ms/config-server/pom.xml @@ -32,6 +32,11 @@ org.springframework.boot spring-boot-starter-actuator + + + org.springframework.cloud + spring-cloud-starter-eureka + org.springframework.boot diff --git a/ms/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java b/ms/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java index ddfd625..4444c33 100644 --- a/ms/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java +++ b/ms/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java @@ -2,6 +2,7 @@ package com.micro.fast.config.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.config.server.EnableConfigServer; /** @@ -12,6 +13,7 @@ import org.springframework.cloud.config.server.EnableConfigServer; */ @SpringBootApplication @EnableConfigServer //开启配置中心相关服务 +@EnableDiscoveryClient//允许注册到注册中心 public class ConfigServerApplication { /** diff --git a/ms/config-server/src/main/resources/application.yml b/ms/config-server/src/main/resources/application.yml index fe34cb3..82f83b1 100644 --- a/ms/config-server/src/main/resources/application.yml +++ b/ms/config-server/src/main/resources/application.yml @@ -28,3 +28,8 @@ info: name: "@project.name@" #从pom.xml中获取 description: "@project.description@" version: "@project.version@" +eureka: + client: + service-url: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + diff --git a/ms/gateway/src/main/resources/bootstrap.yml b/ms/gateway/src/main/resources/bootstrap.yml index 9a254c9..564d990 100644 --- a/ms/gateway/src/main/resources/bootstrap.yml +++ b/ms/gateway/src/main/resources/bootstrap.yml @@ -2,7 +2,15 @@ spring: cloud: config: - uri: http://127.0.0.1:9999/ profile: dev label: master - name: gateway \ No newline at end of file + name: gateway + discovery: + enabled: true + service-id: config-server +eureka: + client: + serviceUrl: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + instance: + hostname: www.gateway.com \ No newline at end of file diff --git a/ms/register-center1/src/main/resources/bootstrap.yml b/ms/register-center1/src/main/resources/bootstrap.yml index 8911124..af409d1 100644 --- a/ms/register-center1/src/main/resources/bootstrap.yml +++ b/ms/register-center1/src/main/resources/bootstrap.yml @@ -6,3 +6,9 @@ spring: profile: dev label: master name: eureka-server +eureka: + client: + service-url: + defaultZone: http://micro:fast@127.0.0.1:10003/eureka #和其他注册中心连接 + instance: + hostname: www.eureka.server.com # 实例的主机名 \ No newline at end of file diff --git a/ms/register-center2/src/main/resources/bootstrap.yml b/ms/register-center2/src/main/resources/bootstrap.yml index 31190b6..22241c2 100644 --- a/ms/register-center2/src/main/resources/bootstrap.yml +++ b/ms/register-center2/src/main/resources/bootstrap.yml @@ -5,3 +5,9 @@ spring: profile: dev label: master uri: http://127.0.0.1:9999/ +eureka: + client: + service-url: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka #和其他注册中心连接 + instance: + hostname: www.eureka.server2.com # 实例的主机名 \ No newline at end of file diff --git a/ms/ucenter/src/main/resources/bootstrap.yml b/ms/ucenter/src/main/resources/bootstrap.yml index df8ea27..72284ee 100644 --- a/ms/ucenter/src/main/resources/bootstrap.yml +++ b/ms/ucenter/src/main/resources/bootstrap.yml @@ -2,7 +2,15 @@ spring: cloud: config: - uri: http://127.0.0.1:9999/ profile: dev label: master - name: ucenter \ No newline at end of file + name: ucenter + discovery: + service-id: config-server + enabled: true +eureka: + client: + serviceUrl: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + instance: + hostname: www.ucenter.com \ No newline at end of file diff --git a/ms/upms/src/main/resources/bootstrap.yml b/ms/upms/src/main/resources/bootstrap.yml index 46b252c..5518449 100644 --- a/ms/upms/src/main/resources/bootstrap.yml +++ b/ms/upms/src/main/resources/bootstrap.yml @@ -5,4 +5,10 @@ spring: uri: http://127.0.0.1:9999/ profile: dev label: master - name: upms \ No newline at end of file + name: upms +eureka: + client: + serviceUrl: + defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + instance: + hostname: www.upms.com \ No newline at end of file