SpringCloud-网关 gateway

网关服务核心是将进入的请求正确合理的路由到下层具体的服务进行业务处理,从它的功能来看,网关服务的核心就是路由信息的构建。

Spring Cloud Gateway 作为 Spring Cloud 生态系统中的网关,目标是替代 Netflix Zuul,其不仅提供统一的路由方式,并且基于 Filter 链的方式提供了网关基本的功能,例如:安全、监控、埋点和限流等。

阅读更多

SpringCloud-熔断器 Hystrix

Hystrix 是 Netflix 的一个开源项目,它能够在服务失效的情况下,通过隔离系统依赖服务的方式,防止服务级联失败,造成服务雪崩。同时Hystrix 还提供了失败回滚机制,使得系统能够更快的从异常中恢复。Hystrix 为服务间调用提供了保护和控制。

阅读更多

SpringCloud-Spring Cloud Context

A Spring Cloud application operates by creating a “bootstrap” context, which is a parent context for the main application. It is responsible for loading configuration properties from the external sources and for decrypting properties in the local external configuration files. The two contexts share an Environment, which is the source of external properties for any Spring application.

By default, bootstrap properties (not bootstrap.properties but properties that are loaded during the bootstrap phase) are added with high precedence, so they cannot be overridden by local configuration.

The bootstrap context uses a different convention for locating external configuration than the main application context. Instead of application.yml (or .properties), you can use bootstrap.yml, keeping the external configuration for bootstrap and main context nicely separate.

阅读更多

SpringCloud-Config 配置中心原理

本篇可以配合《SpringCloud-配置中心 Config》来看,《SpringCloud-配置中心 Config》中是基于SOFABoot 来集成 Spring Cloud Config 的一个 demo 案例。

在demo中,涉及到三个角色:

  • 配置中心服务端:为配置客户端提供对应的配置信息,配置信息的来源是配置仓库。应用启动时,会从配置仓库拉取配置信息缓存到本地仓库中。
  • 配置中心客户端:应用启动时从配置服务端拉取配置信息。
  • 配置仓库:为配置中心服务端提供配置信息存储,Spring Cloud Config 默认是使用git作为仓库的。
阅读更多

SpringCloud-配置中心 Config Apollo

Apollo(阿波罗)是携程框架部门研发的开源配置管理中心,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性。

本篇将搭建一套 Apollo 配置中心环境,并通过一个 demo 案例来演示如何在 SpringCloud 体系中使用 Apollo。

阅读更多

SpringCloud-配置中心 Config Github

在分布式系统中,每一个功能模块都能拆分成一个独立的服务,一次请求的完成,可能会调用很多个服务协调来完成,为了方便服务配置文件统一管理,更易于部署、维护,所以就需要一个地方来管理这些配置信息。

在 spring cloud Config 就提供了这样的能力,通过集中化管理的方式,支持配置文件放在在配置服务的内存中远程 Git 仓库以及Subversion。

本篇将通过一个简单的 demo ,使用 spring cloud Config 原生提供的基于 Git 的方式来实现微服务体系下的配置管理功能。

阅读更多

SpringCloud-Eureka 服务发现

本篇将继续接着上一篇 SpringCloud-服务注册 ,通过使用 DiscoveryClient 来实现服务发现,并且消费。

DiscoveryClient 源自于 spring-cloud-client-discovery ,是 spring cloud 中被定义用来服务发现的公共接口,在 spring cloud 的各类服务发现组件中,都有对应的实现,如 eureka、consul、zookeeper 。它提供从服务注册中心获取服务实例信息的能力。如果我们想自己实现一个服务发现组件,集成到spring cloud 中,就完全可以通过实现此接口来完成。

阅读更多

SpringCloud-Eureka 服务注册

原文: https://blog.csdn.net/sinat_25518349/article/details/85423332

Spring Cloud Netflix Eureka 是 Spring Cloud 提供的用于服务注册和发现的基础组件,在 Spring Cloud 微服务体系中承担着相当重要的角色。Eureka 作为一个开箱即用的基础组件,其屏蔽了底层 Client 和 Server 交互的细节,使得开发者能够快速入手,将更多的精力投入到业务逻辑上去。

阅读更多