配置中心Server端
为什么需要统一配置中心
1、不方便维护。一个功能被多个人开发,如果其中一个人修改了配置文件,另外一个人测试之前的功能,准备使用之前的配置。
2、配置内容安全与权限。线上的配置是不会对开发公开,特别是数据库的账号和密码。把配置文件隔离,不放在开发环境中。
3、更新配置项目需要重启
解决方法:增加配置中心
1、创建config工程

2、选择Config Server 和 Eureka Discovery


3.pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>config</name>
<description>Demo project for Spring Boot</description> <properties>
<java.version>1.8</java.version>
<spring-cloud.version>>Greenwich.M1</spring-cloud.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> <repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories> </project>
4、配置EnableDiscoveryClient

5、配置文件

6、查看注册中心

说明Config 已经注册上来了。
7、要想成为Config server,还需要增加注解@EnableConfigServer

8、在码云上创建git项目 config -repo
1)增加order.yml 文件

2)、增加order-dev.yml文件,环境env为env

3)、增加环境

4)、增加release,在order-dev.yml文件增加label
运行config工程
http://localhost:8080/release/order-dev.yml release就是在码云上创建的release分支

配置中心Server端的更多相关文章
- 创建配置中心服务端(Spring Cloud Config)
创建配置中心服务端 创建好项目后添加配置文件内容 server.port=9004 spring.application.name=spring-cloud-config-server-01 #git ...
- 配置中心Client端
配置中心Client端 1.在Order工程中的Order-Server模块的pom.xml中增加 <dependency> <groupId>org.springframew ...
- springcloud费话之配置中心server修改
目录: springcloud费话之Eureka基础 springcloud费话之Eureka集群 springcloud费话之Eureka服务访问(restTemplate) springcloud ...
- 携程apollo配置中心服务端如何感知配置更新?
引言 前面有写过一篇<分布式配置中心apollo是如何实时感知配置被修改>,也就是客户端client是如何知道配置被修改了,有不少读者私信我你既然说了client端是如何感知的,那服务端又 ...
- .Net配置中心-服务端/客户端
服务端 管理应用,一个应用对应一个站点. 管理应用下的配置. 在保存配置的时候,会更新应用的版本号. 客服端 其他站点引用DLL,并在Global的App_Start中调用ConfigCenter的I ...
- 玩转Spring Cloud之配置中心(config server &config client)
本文内容导航: 一.搭建配置服务中心(config server) 1.1.git方式 1.2.svn方式 1.3.本地文件方式 1.4.解决配置中包含中文内容返回乱码问题 二.搭建配置消费客户端( ...
- springcloud(八):配置中心服务化和高可用
在前两篇的介绍中,客户端都是直接调用配置中心的server端来获取配置文件信息.这样就存在了一个问题,客户端和服务端的耦合性太高,如果server端要做集群,客户端只能通过原始的方式来路由,serve ...
- 二十、springcloud(六)配置中心服务化和高可用
1.问题描述 前一篇,spring-cloud-houge-provider(称之为客户端)直接从spring-cloud-houge-config(称之为服务端)读取配置,客户端和服务端的耦合性太高 ...
- 七、springcloud之配置中心Config(二)之高可用集群
方案一:传统作法(不推荐) 服务端负载均衡 将所有的Config Server都指向同一个Git仓库,这样所有的配置内容就通过统一的共享文件系统来维护,而客户端在指定Config Server位置时, ...
随机推荐
- 【Think in java 读书笔记】多态
在面向对象的程序设计语言中,多态是继数据抽象和继承之后的第三种基本特征.
- REST是什么?
REST -- REpresentational State Transfer 直接翻译:表现层状态转移. @Ivony 老师的一句话概括很精辟: 用URL定位资源,用HTTP动词(GET,POS ...
- linux测试系统使用expdp迁移数据到windos系统,11.2.0.4版本测试
测试,使用linux 系统,迁移至windos测试系统,迁移用户scott 1.源端导出(linux) 2.传输 3.目标端导入(windows) 1.源端导出,本次使用expdp 1)创建操作系统转 ...
- Python3中的运算符
一.Python3中的运算符 强调这是Python3中的运算符 + 加法 - 减法 * 乘法 / 除法 // 整除,只要整数部分 ** 幂运算 % 取余数 ...
- Vim删除文件到行首或者行尾
vim用的不是很熟练,只是有时候需要的时候会学习一下 我们知道,vim有三种模式,一种是一般模式,一种是编辑模式,另外一种是命令行模式 在一般模式下,可以进行删除,复制粘贴等操作,在编辑模式下可以编辑 ...
- Mac os fatal error: 'numpy/arrayobject.h' file not found
$ python setup.py install 出错信息如: clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g ...
- POJO,JaveBean,VO,DTO
POJO - POJO(Plain Ordinary Java Object)简单的Java对象,实际就是普通JavaBeans,是为了避免和EJB混淆所创造的简称. 使用POJO名称是为了避免和EJ ...
- [LeetCode&Python] Problem 771: Jewels and Stones
You're given strings J representing the types of stones that are jewels, and S representing the ston ...
- vue查缺补漏题
一.对于MVVM的理解? MVVM 是 Model-View-ViewModel 的缩写.Model代表数据模型,也可以在Model中定义数据修改和操作的业务逻辑.View 代表UI 组件,它负责将数 ...
- SEO : 建站注意
1.url格式.尽可能的短一些,实践证明,较短的url格式还是比较利于搜索引擎收录的. 2.网站前台要纯静态.虽然搜索引擎对静态页面和动态页面并没有本质上的差别对待,但是实践告诉我们静态页面对服务器的 ...