配置中心:

  1. open API
  2. 配置生效监控
  3. 一致性的K-V存储
  4. 统一配置的实时推送
  5. 配置全局恢复、备份、历史版本
  6. 高可用集群

通过config 获取配置,流程:

下面介绍,基于spring cloud config配置中心管理配置的使用,config配合Git,Svn,Mysql 等配合使用,本示例基于Config+Git:

基于父工程创建config工程(my-cloud-config):

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>com.springcloud.</groupId>
<artifactId>eureka-test</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.cloud.my</groupId>
<artifactId>my-cloud-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>my-cloud-config</name>
<description>Demo project for Spring Boot</description> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> </project>

启动类:

@SpringBootApplication
@EnableConfigServer
public class MyCloudConfigApplication { public static void main(String[] args) {
SpringApplication.run(MyCloudConfigApplication.class, args);
} }

配置文件:

spring.cloud.config.server.git.uri=https://github.com/shiguota/spring-cloud-config.git
spring.cloud.config.server.git.search-paths=my-cloud-config
spring.application.name=my-cloud-config
server.port=1001

启动程序会输出如下日志:

通过日志显示的路径格式访问即可获取Git中的配置文件具体的配置;

Spring Cloud Config 搭建Config 服务的更多相关文章

  1. Spring Cloud 如何搭建Config

    利用spring cloud 的 spring-cloud-config-server 组件 搭建自己的配置中心 config-server 配置文件可以存放在 github ,gitlab 等上面, ...

  2. Spring Cloud 入门 之 Config 篇(六)

    原文地址:Spring Cloud 入门 之 Config 篇(六) 博客地址:http://www.extlight.com 一.前言 随着业务的扩展,为了方便开发和维护项目,我们通常会将大项目拆分 ...

  3. Spring Cloud 系列之 Config 配置中心(二)

    本篇文章为系列文章,未读第一集的同学请猛戳这里:Spring Cloud 系列之 Config 配置中心(一) 本篇文章讲解 Config 如何实现配置中心自动刷新. 配置中心自动刷新 点击链接观看: ...

  4. Spring Cloud 系列之 Config 配置中心(三)

    本篇文章为系列文章,未读前几集的同学请猛戳这里: Spring Cloud 系列之 Config 配置中心(一) Spring Cloud 系列之 Config 配置中心(二) 本篇文章讲解 Conf ...

  5. spring cloud 专题二(spring cloud 入门搭建 之 微服务搭建和注册)

    一.前言 本文为spring cloud 微服务框架专题的第二篇,主要讲解如何快速搭建微服务以及如何注册. 本文理论不多,主要是傻瓜式的环境搭建,适合新手快速入门. 为了更好的懂得原理,大家可以下载& ...

  6. Spring Cloud Alibaba Nacos Config 实战

    Nacos 提供用于存储配置和其他元数据的 key/value 存储,为分布式系统中的外部化配置提供服务器端和客户端支持.使用 Spring Cloud Alibaba Nacos Config,您可 ...

  7. Spring Cloud Alibaba Nacos Config 的使用

    Spring Cloud Alibaba Nacos Config 的使用 一.需求 二.实现功能 1.加载 product-provider-dev.yaml 配置文件 2.实现配置的自动刷新 3. ...

  8. 《Spring Cloud与Docker微服务架构实战》配套代码

    不才写了本使用Spring Cloud玩转微服务架构的书,书名是<Spring Cloud与Docker微服务架构实战> - 周立,已于2017-01-12交稿.不少朋友想先看看源码,现将 ...

  9. Spring Cloud 系列之 Gateway 服务网关(三)

    本篇文章为系列文章,未读第一集的同学请猛戳这里: Spring Cloud 系列之 Gateway 服务网关(一) Spring Cloud 系列之 Gateway 服务网关(二) 本篇文章讲解 Ga ...

  10. Spring Cloud 系列之 Gateway 服务网关(四)

    本篇文章为系列文章,未读第一集的同学请猛戳这里: Spring Cloud 系列之 Gateway 服务网关(一) Spring Cloud 系列之 Gateway 服务网关(二) Spring Cl ...

随机推荐

  1. 移动页面请使用CSS3动画

    说到动画,我们一般会使用jQuery 中的animate(); 在PC浏览器中,是很方便的,由于PC的高性能,这种不断修改DOM的做法确实不会出现太大的问题,但是在手机端就不同了. 手机上使用jQue ...

  2. matlab vs联调

    vs 和matlab联调,最近真的把我搞挂了要. 首先,怎么进入联调呢.在vs里先设置一下. vs:tools->attach to process,选择matlab,注意此时matlab一定是 ...

  3. cordova-plugin-themeablebrowser 0.2.17 "ThemeableBrowser"ionic跳转外链插件在ios中heardBar会遮住内容的bug

    ionic+angular的app项目中需要在App打开一个外部的url链接,用了这个插件发现在iPhone手机中会出现toolbar挡住url页面内容 解决方法: 在原有基础上加上statusBar ...

  4. ElasticSearch High Level REST API【7】聚合

    获取平均值聚合示例,最大值.最小值.求和类似 public void aggregation(){ RestHighLevelClient client = elasticClient.getRest ...

  5. activemq启动闪退/失败 (Illegal character in hostname at index 5: ws://****:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600)

    java.net.URISyntaxException: Illegal character in hostname at index 5: ws://****:61614?maximumConnec ...

  6. centos7部署harbor

    官网 https://github.com/goharbor/harbor 1.升级系统内核 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrep ...

  7. PLC状态机编程第一篇-状态机介绍

    状态机的一般概念 过去我在学习PLC编程时,看的大部分书仅仅停留在软件的操作上,没有真正讲述如何组织程序,这里我们讲一个通用的描述控制算法的方法,就是状态机,和SFC很类似,其实SFC也是源于状态机啦 ...

  8. Spring---加载配置文件的几种方法(org.springframework.beans.factory.BeanDefinitionStoreException)

    Spring中的几种容器都支持使用xml装配bean,包括:XmlBeanFactory ,ClassPathXmlApplicationContext ,FileSystemXmlApplicati ...

  9. Dragger 2遇到的坑 Dragger2详解 Dragger2学习最好的资料

    我是曹新雨,我为自己代言.现在的菜鸟,3年以后我就是大神.为自己加油.微信:aycaoxinyu Dragger2是什么,我就不再说了.资料一堆,而且里面的注解什么意思,我推荐两篇文章,这两篇都是我精 ...

  10. easyui 获取树的平级根节点的父节点&选择性展示树的一个根节点

    1.easyui的树的根节点一般是几个平级的,怎样获取这些父节点的id? 可以将获取到的平级根节点放在一个数组中 var roots=[]; roots=$("#tree1").t ...