Spring Cloud Config 搭建Config 服务
配置中心:
- open API
- 配置生效监控
- 一致性的K-V存储
- 统一配置的实时推送
- 配置全局恢复、备份、历史版本
- 高可用集群
通过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 服务的更多相关文章
- Spring Cloud 如何搭建Config
利用spring cloud 的 spring-cloud-config-server 组件 搭建自己的配置中心 config-server 配置文件可以存放在 github ,gitlab 等上面, ...
- Spring Cloud 入门 之 Config 篇(六)
原文地址:Spring Cloud 入门 之 Config 篇(六) 博客地址:http://www.extlight.com 一.前言 随着业务的扩展,为了方便开发和维护项目,我们通常会将大项目拆分 ...
- Spring Cloud 系列之 Config 配置中心(二)
本篇文章为系列文章,未读第一集的同学请猛戳这里:Spring Cloud 系列之 Config 配置中心(一) 本篇文章讲解 Config 如何实现配置中心自动刷新. 配置中心自动刷新 点击链接观看: ...
- Spring Cloud 系列之 Config 配置中心(三)
本篇文章为系列文章,未读前几集的同学请猛戳这里: Spring Cloud 系列之 Config 配置中心(一) Spring Cloud 系列之 Config 配置中心(二) 本篇文章讲解 Conf ...
- spring cloud 专题二(spring cloud 入门搭建 之 微服务搭建和注册)
一.前言 本文为spring cloud 微服务框架专题的第二篇,主要讲解如何快速搭建微服务以及如何注册. 本文理论不多,主要是傻瓜式的环境搭建,适合新手快速入门. 为了更好的懂得原理,大家可以下载& ...
- Spring Cloud Alibaba Nacos Config 实战
Nacos 提供用于存储配置和其他元数据的 key/value 存储,为分布式系统中的外部化配置提供服务器端和客户端支持.使用 Spring Cloud Alibaba Nacos Config,您可 ...
- Spring Cloud Alibaba Nacos Config 的使用
Spring Cloud Alibaba Nacos Config 的使用 一.需求 二.实现功能 1.加载 product-provider-dev.yaml 配置文件 2.实现配置的自动刷新 3. ...
- 《Spring Cloud与Docker微服务架构实战》配套代码
不才写了本使用Spring Cloud玩转微服务架构的书,书名是<Spring Cloud与Docker微服务架构实战> - 周立,已于2017-01-12交稿.不少朋友想先看看源码,现将 ...
- Spring Cloud 系列之 Gateway 服务网关(三)
本篇文章为系列文章,未读第一集的同学请猛戳这里: Spring Cloud 系列之 Gateway 服务网关(一) Spring Cloud 系列之 Gateway 服务网关(二) 本篇文章讲解 Ga ...
- Spring Cloud 系列之 Gateway 服务网关(四)
本篇文章为系列文章,未读第一集的同学请猛戳这里: Spring Cloud 系列之 Gateway 服务网关(一) Spring Cloud 系列之 Gateway 服务网关(二) Spring Cl ...
随机推荐
- wm_concat()函数
工作中遇到这样一个问题,一张数据库表中有一个字段file_id,还有一个主键f_id(唯一),而file_id不唯一,我想把file_id=‘123456789’的记录中的f_id(主键)连接成一个字 ...
- JSON后台处理特殊字符方法,在JSONArray.fromObject转换时处理
/** * 替换一个字符串中的某些指定字符 * @param strData String 原始字符串 * @param regex String 要替换的字符串 * @param replaceme ...
- Redis ---------- key的操作
key命名规则 除空格和\n,其他都可以 select db -index选择数据库 例1 select 5 例2 type 查看数据key类型 type name 例3 keys pat ...
- python中的字典内置方法小结
#!/usr/local/bin/python3 # -*- coding:utf-8 -*- #key-value #dict 无序,无下标,不需要下标,因为有key stu={ 'stu001': ...
- 小明的存钱计划 南阳acm54
小明的存钱计划 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 小明的零花钱一直都是自己管理.每个月的月初妈妈给小明300元钱,小明会预算这个月的花销,并且总能做到实际花 ...
- 第三章 文件 I/O
3.1 引言 先说明可用的文件 I/O 函数:open.read.write.close,然后说明不同缓冲区长度对read和write函数的影响. 本章所说的函数经常被称为不带缓冲的 I/O (unb ...
- Codeforces146D 概率DP
Bag of mice The dragon and the princess are arguing about what to do on the New Year's Eve. The drag ...
- 笔记-scrapy-signal
笔记-scrapy-signal 1. scrapy singal 1.1. 信号机制 scrapy的信号机制主要由三个模块完成 signals.py 定义信号量 signalmana ...
- Mysql处理海量数据时的一些优化查询速度方法【转】
最近一段时间由于工作需要,开始关注针对Mysql数据库的select查询语句的相关优化方法.由于在参与的实际项目中发现当mysql表的数据量达到百万级时,普通SQL查询效率呈直线下降,而且如果wher ...
- java程序——凯撒加密
古罗马皇帝凯撒在打仗时曾经使用过以下方法加密军事情报: 请编写一个程序,使用上述算法加密或解密用户输入的英文字串要求设计思想.程序流程图.源代码.结果截图. 设计思想:输入一个字符串,然后将其中每 ...