配置中心:

  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. Ubuntu下几种常用的文本编辑器

    常见的基于控制台的文本编辑器有以下几种: emacs           综合性的GNU emacs 编辑环境 nano              一个类似于经典的pico的文本编辑器,内置了一个pi ...

  2. CUDA 纹理内存

    原文链接 1.概述 纹理存储器中的数据以一维.二维或者三维数组的形式存储在显存中,可以通过缓存加速访问,并且可以声明大小比常数存储器要大的多. 在kernel中访问纹理存储器的操作称为纹理拾取(tex ...

  3. 楔积(Wedge Procut)

    原文链接 由拓扑学中表面(Surface)的定义及实例引入楔积的概念. 基础知识 先看Surface在欧几里得空间内的定义: 所有在Omega中的点w(参数空间中的点)被记作: 对应在R3中(欧几里德 ...

  4. 旧文备份:windows下编译和使用IT++

    1.下载IT++最新版:<a href="http://sourceforge.net/projects/itpp/">http://sourceforge.net/p ...

  5. Eclipse Git 插件 基本操作一【learn】

    安装GIT插件: 我的Eclipse版本为: Oxygen.2 Release (4.7.2),所以自带GIT插件,跳过安装. GIT插件配置: ①.添加好用户名和邮箱 注意下输入格式:user.na ...

  6. 在jdbc基础上进阶一小步的C3p0 连接池(DBCP 不能读xml配置文件,已淘汰) 和DBUtils 中两个主要类QueryRunner和ResultSetHandler的使用

    首先看C3p0这个连接池,最大优势可以自动读取默认的配置文件 <?xml version="1.0" encoding="UTF-8"?> < ...

  7. java基础 数组 Set Map 集合综合应用 生成带0的随机字符串 "00000001" 水果商品号问题

    package com.swift.test01; /*有四种水果(苹果,香蕉,西瓜,橘子) 1.给每种水果设定一个商品号,商品号是8个0-9的随机数,商品号码不能重复, 最小值 "0000 ...

  8. 优化tableView性能(针对滑动时出现卡的现象)

    优化tableView性能(针对滑动时出现卡的现象) 在iOS应用中,UITableView应该是使用率最高的视图之一了.iPod.时钟.日历.备忘录.Mail.天气.照片.电话.短信. Safari ...

  9. view的superview的变换

    今天遇到一个奇怪的问题,一个view(称为subview)被加在了一个cell(superView1)上,然后创建了一个view(为superView2),将subview重新加在了superView ...

  10. UVa新汉诺塔问题(A Different Task,Uva 10795)

    主要需要理递归函数计算 #define MAXN 60+10 #include<iostream> using namespace std; int n,k,S[MAXN],F[MAXN] ...