配置中心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位置时, ...
随机推荐
- delete CDU
function DeletePDU(){ global $person; $this->MakeSafe(); // Do not attempt anything else if the l ...
- snmp 简单网管协议
snmpget是取具体的OID的值.(适用于OID值是一个叶子节点的情况) snmpwalk snmpwalk — Fetch all the SNMP objects from an agent & ...
- Java学习笔记29(IO字符流,转换流)
字符流:只能操作文本文件,与字节流的区别是,字节流是按照字节来读取文件,而字符流是按照字符来读取,因此字符流的局限性为文本文件 字符输出流:Write类,使用时通过子类 每一次写入都要刷新 pac ...
- C# 曲线控件 曲线绘制 实时曲线 多曲线控件 开发
Prepare 本文将使用一个NuGet公开的组件来实现曲线的显示,包含了多种显示的模式和配置来满足各种不同的应用场景,方便大家进行快速的开发系统. 在Visual Studio 中的NuGet管理器 ...
- 登陆网页模板 - 1 (HTML+CSS)
一个用HTML和CSS写的简单登录页面,主要是用CSS来进行修饰美化的 这个登陆界面有输入账号和密码的表单,还有登陆和注册两个按键,点击按键分别会输出“您已成功登陆,稍后会跳转到您需要的页面~”,“您 ...
- JS/JavaScript简介及基本常识
JavaScript (JS)以客户端事件为驱动的弱类型脚本语言 JS脚本一般写在<head>内部 流:文本流.html流 回避关键字的基本策略:单词合并(v_function) null ...
- 2.18 爬页面源码(page_source)
2.18 爬页面源码(page_source) 前言有时候通过元素的属性的查找页面上的某个元素,可能不太好找,这时候可以从源码中爬出想要的信息.selenium的page_source方法可以获取到页 ...
- Python学习笔记第六周
目录 一.基础概念 面向对象编程 1.面向对象的几个核心特点 1.class类 2.object对象 3.encapsulation封装 4.inheritance继承 5.polymorphism多 ...
- CentOS中yum安装ffmpeg
1.升级系统 sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2.安装Nux Dextop Yum 源 ...
- Linux关闭透明大页配置
一.为何要关闭透明大页 A--MOS获取 . #翻译 由于透明超大页面已知会导致意外的节点重新启动并导致RAC出现性能问题,因此Oracle强烈建议禁用透明超大页面. 另外,即使在单实例数据库环境 ...