将配置中心注册到服务发现中心,便于实现注册中心的高可用
This commit is contained in:
@@ -5,4 +5,10 @@ spring:
|
||||
uri: http://127.0.0.1:9999/
|
||||
profile: dev
|
||||
label: master
|
||||
name: cms
|
||||
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
|
||||
@@ -32,6 +32,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--服务提供以及调用负载均衡-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
</dependency>
|
||||
<!--测试-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
+2
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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/ #配置所有的注册中心
|
||||
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
spring:
|
||||
cloud:
|
||||
config:
|
||||
uri: http://127.0.0.1:9999/
|
||||
profile: dev
|
||||
label: master
|
||||
name: gateway
|
||||
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
|
||||
@@ -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 # 实例的主机名
|
||||
@@ -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 # 实例的主机名
|
||||
@@ -2,7 +2,15 @@
|
||||
spring:
|
||||
cloud:
|
||||
config:
|
||||
uri: http://127.0.0.1:9999/
|
||||
profile: dev
|
||||
label: master
|
||||
name: ucenter
|
||||
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
|
||||
@@ -5,4 +5,10 @@ spring:
|
||||
uri: http://127.0.0.1:9999/
|
||||
profile: dev
|
||||
label: master
|
||||
name: upms
|
||||
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
|
||||
Reference in New Issue
Block a user