方便服务配置文件统一管理,实时更新

组成

spring cloud config组件中,分两个角色,一是config server,二是config client

Config Server是一个可横向扩展、集中式的配置服务器,它用于集中管理应用程序各个

环境下的配置,默认使用Git存储配置文件内容,也可以使用SVN存储,或者是本地文件

存储。

Config ClientConfig Server的客户端,用于操作存储在Config Server中的配置内容。

微服务在启动时会请求Config Server获取配置文件的内容,请求到后再启动容器

配置中心微服务

依赖

<dependency>
groupId>org.springframework.cloud</groupId>
artifactId>spring-cloud-config-server</artifactId>
</dependency> 启动类 @SpringBootApplication
@EnableConfigServer
public class ConfigApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigApplication.class, args);
}
} application.yml server:
port: 9998
spring:
application:
name: tensquare‐config
cloud:
config:
server:
git:
uri: https://gitee.com/ld/tensquare‐config.git
basedir: E:\Java\config\basedir #可以使用这个配置项来指定本地git仓库的路径 #git的用户名
spring.cloud.config.server.git.username=username
#git的密码
spring.cloud.config.server.git.password=password

配置客户端

依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency> bootstrap.yml spring:
cloud:
config:
#/{label}/{name}-{profiles}.yml
name: user #一般以服务名来命名
profile: dev #一般作为环境标识,开发环境(dev)、测试环境(test)、生产环境(product)
label: master
uri: http://127.0.0.1:9998 假如在不同环境下有很多共用的配置,我们可以再创建一个user.yml用来存放共同配置
springcloud-config取配置时,会将你的对应环境配置与user.yml合并后再返回(前缀name相同)。

SpringCloudConfig的更多相关文章

  1. SpringCloud-config分布式配置中心

    为什么要统一管理微服务配置? 随着微服务不断的增多,每个微服务都有自己对应的配置文件.在研发过程中有测试环境.UAT环境.生产环境,因此每个微服务又对应至少三个不同环境的配置文件.这么多的配置文件,如 ...

  2. SpringCloudConfig配置中心git库以及refresh刷新

    基于git库的Spring Cloud Config配置中心代码demo下载地址:https://gitlab.com/mySpringCloud/config-git SpringBoot版本: 1 ...

  3. SpringCloud系列十:SpringCloudConfig 高级配置(密钥加密处理(JCE)、KeyStore 加密处理、SpringCloudConfig 高可用机制、SpringCloudBus 服务总线)

    1.概念:SpringCloudConfig 高级配置 2.具体内容 在 SpringCloudConfig 之中考虑到所有配置文件都暴露在远程仓库之中的安全性问题,所以提供有安全访问的处理机制,这样 ...

  4. SpringCloud系列九:SpringCloudConfig 基础配置(SpringCloudConfig 的基本概念、配置 SpringCloudConfig 服务端、抓取配置文件信息、客户端使用 SpringCloudConfig 进行配置、单仓库目录匹配、应用仓库自动选择、仓库匹配模式)

    1.概念:SpringCloudConfig 基础配置 2.具体内容 通过名词就可以发现,SpringCloudConfig 核心作用一定就在于进行配置文件的管理上.也就是说为了更好的进行所有微服务的 ...

  5. spring-cloud-config——Quick Start

    参考资料: https://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.4.0.RELEASE/single/spring-cl ...

  6. 六:SpringCloud-Config

    十:SpringCloudConfig分布式配置中心 1. 概述 1.1 分布式系统面临的 配置问题 微服务意味着要将单体应用中的业务拆分成一个个子服务,每个服务的粒度相对较小,因此系统中会出现大量的 ...

  7. spring-cloud-config笔记

    忽略元数据末尾 回到原数据开始处 spring-cloud-config 简单来讲就是spring-cloud实现的分布式配置中心.与之前介绍的开源配置服务方案 disconf是一样的,spring- ...

  8. spring-cloud-config 配置中心快速上手

    spring-cloud-config 配置中心实现 Spring Cloud Config 用于为分布式系统中的基础设施和微服务应用提供集中化的外部配置支持,分为server端和client端. s ...

  9. springcloud学习之路: (五) springcloud集成SpringCloudConfig分布式配置中心

    SpringCloud全家桶中的分布式配置中心SpringCloudConfig, 它使用git来管理配置文件, 在修改配置文件后只需要调用一个接口就可以让新配置生效, 非常方便. SpringClo ...

  10. SpringCloud-Config通过Java访问URL对敏感词加密解密

    特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...

随机推荐

  1. Warshall算法和Floyd算法

    不用说这两位都是冷门算法……毕竟O(n^3)的时间复杂度算法在算法竞赛里基本算是被淘汰了……而且也没有在这个算法上继续衍生出其他的算法… 有兴趣的话:click here.. 话说学离散的时候曾经有个 ...

  2. g++优化开关(暴力必备)

    ) %:pragma GCC optimize("Ofast") %:pragma GCC optimize("inline") %:pragma GCC op ...

  3. 开启SSH 使用SSH登录工具连接虚拟机

    修改sshd_config文件,命令为:vi /etc/ssh/sshd_config将#PermitRootLogin without-password注释去掉修改为PermitRootLogin ...

  4. python3添加requests库

    1.资源下载 https://codeload.github.com/psf/requests/zip/master https://www.python.org/ https://files.pyt ...

  5. shell脚本输出空心等腰三角形

    第一种:(for循环) #!/bin/bash#空心等腰三角形arr=9 #定义金字塔的层数for ((i=1;i<=$arr;i++))do for ((j=1;j<=$(($arr-$ ...

  6. zmq作为守护进程?等待连接

    服务端是作为守护进程在运行的,客户端connect成功,但write时直接退出了,我在想肯能服务端socket在write时已经失效了,不然为什么会出现write时进程退出呢?现在的问题是,我要怎么才 ...

  7. leetcood学习笔记-226- 翻转二叉树

    题目描述: 第一次提交: class Solution(object): def invertTree(self, root): """ :type root: Tree ...

  8. Delphi txt文件读取及写入

    简介:Delphi支持三种文件类型:文本文件.记录文件.无类型文件.文本文件的读...   在进行win32开发中对文件的读写是最常用的操作之一 Delphi 支持三种文件类型:  文本文件.记录文件 ...

  9. QueryList 来做采集是什么样子

    采集百度搜索结果列表的标题和链接. $data = QueryList::get('https://www.baidu.com/s?wd=QueryList') // 设置采集规则 ->rule ...

  10. 暴力模拟——cf988E

    很简单的题,就是模拟一下 #include<bits/stdc++.h> using namespace std; #define ll long long ll n,a[],len; i ...