十、SpringCloud 微服务之SpringCloud Config 分布式配置中心


一、SpringCloud 微服务基础介绍
二、SpringCloud 微服务项目构建
三、SpringCloud 微服务之Eureka 服务注册与发现
四、SpringCloud 微服务之 Zookeeper 服务注册与发现
五、SpringCloud 微服务之Consul 服务注册与发现
六、SpringCloud 微服务之 Ribbon 负载均衡服务调用
七、SpringCloud 微服务之 OpenFeign 服务接口调用
八、SpringCloud 微服务之 Hystrix 断路器
九、Spring Cloud 微服务之 Gateway
十、SpringCloud 微服务之SpringCloud Config 分布式配置中心
十一、SpringCloud 微服务之SpringCloud Bus 消息总线
十二、SpringCloud 微服务之SpringCloud Stream 消息驱动
十三、Spring Cloud 微服务之 SpringCloud Sleuth 分布式请求链路跟踪
十四、SpringCloud Alibaba Nacos 服务注册和配置中心
十五、SpringCloud Alibaba Sentinel 实现熔断与限流
十六、SpringCloud Alibaba Seata 处理分布式事务

SpringCloud Config 分布式配置中心

SpringCloud Config 官网地址:https://docs.spring.io/spring-cloud-config/docs/current/reference/html/

1. 概述

1.1 分布式系统面临的—配置问题

微服务意味着要将单体应用中的业务拆分成一个个子服务,每个服务的粒度相对较小,因此系统中会出现大量的服务。由于每个服务都需要必要的配置信息才能运行,所以一套集中式、动态的配置管理设施是必不可少的。

1.2 是什么

在这里插入图片描述

  • 是什么:
    Springcloud config为微服务架构中的微服务提供集中化的外部配置支持,配置服务器为各个不同微服务应用的所有环境提供一个中心化的外部配置
  • 怎么玩:
    Springcloud Config分为服务端和客户端两部分
    服务端也称分布式配置中心,它是一个独立的微服务应用,用来连接配置服务器并未客户端提供获取配置信息,加密、解密信息等访问接口。
    客户端则是通过指定的配置中心来管理应用资源,以及与业务相关的配置内容,并在启动的时候从配置中心获取和加载配置信息,配置服务器默认采用git来存储配置信息,这样就有助于对环境配置进行版本管理,并且可以通过git客户端工具方便的管理和访问配置内容。

1.3 能干嘛

  • 集中管理配置文件
  • 不同环境不同配置,动态化的配置更新,分环境部署,eg:dev/test/prod/beta/release
  • 运行期间动态调整配置,不再需要在每个服务部署的机器上编写配置文件,服务会向配置中心统一拉取自己的配置信息
  • 当配置发生变动时,服务不需要重启即可感知到配置的变化并应用新的配置
  • 将配置信息以REST接口的形式暴露

2. Config服务端配置与测试

  1. 在GitHub上新建springcloud-config的Respository
  2. 创建配置文件 ,并编写
    在这里插入图片描述
    在这里插入图片描述
  3. 由上一步获得刚新建的git地址
  4. 本地硬盘目录上新建Git仓库并clone

2.1 在父项目中创建 cloud-config-center3344 配置中心服务module

1. 修改 pom
<?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">
    <parent>
        <artifactId>springcloud</artifactId>
        <groupId>com.zzx</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>cloud-config-center3344</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-eureka-client</artifactId>
        </dependency></
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值