From 141e2433b00f54af04a2dd674a6a991eb3ec9ae9 Mon Sep 17 00:00:00 2001
From: lsy <18332763730@163.com>
Date: Sat, 21 Oct 2017 14:01:28 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=BF=83?=
=?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=88=B0=E6=9C=8D=E5=8A=A1=E5=8F=91=E7=8E=B0?=
=?UTF-8?q?=E4=B8=AD=E5=BF=83=EF=BC=8C=E4=BE=BF=E4=BA=8E=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=B8=AD=E5=BF=83=E7=9A=84=E9=AB=98=E5=8F=AF?=
=?UTF-8?q?=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ms/cms/src/main/resources/bootstrap.yml | 8 +++++++-
ms/config-server/pom.xml | 5 +++++
.../fast/config/server/ConfigServerApplication.java | 2 ++
ms/config-server/src/main/resources/application.yml | 5 +++++
ms/gateway/src/main/resources/bootstrap.yml | 12 ++++++++++--
ms/register-center1/src/main/resources/bootstrap.yml | 6 ++++++
ms/register-center2/src/main/resources/bootstrap.yml | 6 ++++++
ms/ucenter/src/main/resources/bootstrap.yml | 12 ++++++++++--
ms/upms/src/main/resources/bootstrap.yml | 8 +++++++-
9 files changed, 58 insertions(+), 6 deletions(-)
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