1. 程式人生 > >從零開始搭建spring-cloud(0) --springboot與springcloud的關係

從零開始搭建spring-cloud(0) --springboot與springcloud的關係

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer’s own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.
Spring Cloud為開發人員提供了快速構建分散式系統中一些常見的元件(例如配置管理,服務發現,斷路器,智慧路由,微代理,控制匯流排,一次性tokens,全域性鎖,選舉,分散式session,叢集監測)。各個元件之間可以很好的銜接, 使用Spring Cloud開發人員可以快速地支援實現這些元件服務和應用程式。他們將在任何分散式環境中都可以很好地執行,即使在開發人員自己的膝上型電腦,零配置的資料中心,以及Cloud Foundry等託管平臺。

 Features 特性

Spring Cloud 更專注於提高元件"開箱即用"的體驗,提供良好的擴充套件機制。

  • Distributed/versioned configuration  分散式/版本化配置

  • Service registration and discovery 服務註冊和發現

  • Routing 路由

  • Service-to-service calls 服務和服務之間的呼叫

  • Load balancing 負載均衡

  • Circuit Breakers 斷路由

  • Global locks 全域性鎖

  • Leadership election and cluster state 領導選舉和叢集狀態

  • Distributed messaging 分散式訊息傳遞

 Spring Cloud採用了一種非常宣告性的方法,通常只需更改classpath或annotation就可以使用很多特性。例如下面的一個discovery 客戶端:

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

Main Projects 重要專案

Spring Cloud Config


    Centralized external configuration management backed by a git repository. The configuration resources map directly to Spring Environment but could be used by non-Spring applications if desired.

    由git倉庫提供集中管理,配置資源可以直接對映到Spring環境中去,也可以根據需要對映到其他非Spring應用上。

Spring Cloud Netflix    

Integration with various Netflix OSS components (Eureka, Hystrix, Zuul, Archaius, etc.).

與其他Netflix元件(Eureka, Hystrix, Zuul, Archaius等等)整合。

Spring Cloud Bus

An event bus for linking services and service instances together with distributed messaging. Useful for propagating state changes across a cluster (e.g. config change events).
    事件匯流排用分散式訊息佇列連線各個服務例項,用於跨叢集傳播狀態更改(例如配置更改事件)。

Spring Cloud Cloudfoundry

    Integrates your application with Pivotal Cloud Foundry. Provides a service discovery implementation and also makes it easy to implement SSO and OAuth2 protected resources.
    使用Pivotal Cloud Foundry整合自己的應用,提供了服務發現,並且使SSO和OAuth2的實現更加簡單。Spring Cloud for Cloudfoundry可以輕鬆地在Cloud Foundry(平臺即服務)中執行Spring Cloud應用程式。 Cloud Foundry具有“服務”的概念,即“繫結”到應用程式的中介軟體,實質上為其提供包含憑據的環境變數(例如,用於服務的位置和使用者名稱)。

Spring Cloud Open Service Broker

    Provides a starting point for building a service broker that implements the Open Service Broker API.
    Spring Cloud Open Service Broker是一個用於構建實現Open Service Broker API的Spring Boot應用程式的框架。

Spring Cloud Cluster

Leadership election and common stateful patterns with an abstraction and implementation for Zookeeper, Redis, Hazelcast, Consul.
    提供Leadership選舉,如:Zookeeper, Redis, Hazelcast, Consul等常見狀態模式的抽象和實現    

Spring Cloud Consul

    Service discovery and configuration management with Hashicorp Consul.
    Consul 是 HashiCorp 公司推出的開源工具,用於實現分散式系統的服務發現與配置。

Spring Cloud Security

    Provides support for load-balanced OAuth2 rest client and authentication header relays in a Zuul proxy.
    在Zuul閘道器中,為OAuth2 rest客戶端和認證頭負載均衡提供支援。

Spring Cloud Sleuth

    Distributed tracing for Spring Cloud applications, compatible with Zipkin, HTrace and log-based (e.g. ELK) tracing.
    分散式Spring Cloud Application服務鏈路追蹤,相容Zipkin,HTrace 和log-based(例如ELK)。

Spring Cloud Data Flow

    A cloud-native orchestration service for composable microservice applications on modern runtimes. Easy-to-use DSL, drag-and-drop GUI, and REST-APIs together simplifies the overall orchestration of microservice based data pipelines.
    管道由Spring Boot應用程式組成,使用Spring Cloud Stream或Spring Cloud Task微服務框架構建。 這使得Spring Cloud Data Flow適用於各種資料處理用例,從匯入/匯出到事件流和預測分析。

Spring Cloud Stream

    A lightweight event-driven microservices framework to quickly build applications that can connect to external systems. Simple declarative model to send and receive messages using Apache Kafka or RabbitMQ between Spring Boot apps.
    輕量級事件驅動微服務可以快速與外部系統連線,可以用Apache Kafka或者RabbitMQ實現簡單的訊息傳送和接收。

Spring Cloud Stream App Starters

    Spring Cloud Stream App Starters are Spring Boot based Spring Integration applications that provide integration with external systems.
    這是最幾班的spring應用整合。

Spring Cloud Task

    A short-lived microservices framework to quickly build applications that perform finite amounts of data processing. Simple declarative for adding both functional and non-functional features to Spring Boot apps.
    Spring Cloud Task的目標是為Spring Boot應用程式提供建立短執行期微服務的功能。在Spring Cloud Task中,我們可以靈活地動態執行任何任務,按需分配資源並在任務完成後檢索結果。Tasks是Spring Cloud Data Flow中的一個基礎專案,允許使用者將幾乎任何Spring Boot應用程式作為一個短期任務執行。

Spring Cloud Task App Starters

    Spring Cloud Task App Starters are Spring Boot applications that may be any process including Spring Batch jobs that do not run forever, and they end/stop after a finite period of data processing.

Spring Cloud Zookeeper

    Service discovery and configuration management with Apache Zookeeper.
    使用Apache Zookeeper作為服務發現和配置管理

Spring Cloud AWS

    Easy integration with hosted Amazon Web Services. It offers a convenient way to interact with AWS provided services using well-known Spring idioms and APIs, such as the messaging or caching API. Developers can build their application around the hosted services without having to care about infrastructure or maintenance.
    很方便的整合AWS。提供一個便捷的方式與AWS提供的服務進行互動,開發者不需要關心他的設計與維護。

Spring Cloud Connectors

    Makes it easy for PaaS applications in a variety of platforms to connect to backend services like databases and message brokers (the project formerly known as "Spring Cloud").
    使各種平臺中的PaaS應用程式更容易連線到資料庫和訊息代理等後端服務

Spring Cloud Starters

    Spring Boot-style starter projects to ease dependency management for consumers of Spring Cloud. (Discontinued as a project and merged with the other projects after Angel.SR2.)
    Spring Boot-style starter專案,以簡化Spring Cloud使用者的依賴項管理。

Spring Cloud CLI

    Spring Boot CLI plugin for creating Spring Cloud component applications quickly in Groovy
    使用Groovy快速搭建Spring Cloud元件。

Spring Cloud Contract

    Spring Cloud Contract is an umbrella project holding solutions that help users in successfully implementing the Consumer Driven Contracts approach.
    一旦服務和服務之間定義了契約,Spring cloud contract會為服務消費端提供stub的mock server,這樣,使用者就可以只關注自己的服務進行測試,同時也不需要寫大量的整合測試。

Spring Cloud Gateway

    Spring Cloud Gateway is an intelligent and programmable router based on Project Reactor.
    Spring Cloud Gateway是Spring Cloud官方推出的第二代閘道器框架,取代Zuul閘道器。閘道器作為流量的,在微服務系統中有著非常作用,閘道器常見的功能有路由轉發、許可權校驗、限流控制等作用。

Spring Cloud OpenFeign

Spring Cloud OpenFeign provides integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.    
    作為Spring Cloud的子專案之一,Spring Cloud OpenFeign以將OpenFeign整合到Spring Boot應用中的方式,為微服務架構下服務之間的呼叫提供瞭解決方案。首先,利用了OpenFeign的宣告式方式定義Web服務客戶端;其次還更進一步,通過整合Ribbon或Eureka實現負載均衡的HTTP客戶端。

Spring Cloud Pipelines

    Spring Cloud Pipelines provides an opinionated deployment pipeline with steps to ensure that your application can be deployed in zero downtime fashion and easilly rolled back of something goes wrong.

Spring Cloud Function

 Spring Cloud Function promotes the implementation of business logic via functions. It supports a uniform programming model across serverless providers, as well as the ability to run standalone (locally or in a PaaS).

 Release Trains

Spring Cloud is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio a BOM (Bill of Materials) is published with a curated set of dependencies on the individual project (see below). The release trains have names, not versions, to avoid confusion with the sub-projects. The names are an alphabetic sequence (so you can sort them chronologically) with names of London Tube stations ("Angel" is the first release, "Brixton" is the second). When point releases of the individual projects accumulate to a critical mass, or if there is a critical bug in one of them that needs to be available to everyone, the release train will push out "service releases" with names ending ".SRX", where "X" is a number.

Spring Cloud是一個大型工程專案,由一些列獨立的專案組成,在原則上具有不同的釋出節奏。為了管理組合,釋出了一個BOM(版本清單),其中包含一組對單個專案的依賴關係(見下面)。為了避免與子專案混淆,釋出軟體版本串有名稱,而沒有版本。這些名字是按字母順序排列的(所以你可以按時間順序排列),還有倫敦地鐵站的名字(“Angel”是第一個版本,“Brixton”是第二個版本)。當單個專案的釋出點累積到一個臨界量時,或者如果其中有一個臨界bug需要對所有人可用,那麼釋出序列將推出名稱以“service release”,以“.SRX”結尾。,其中“X”是一個數字。

 

Table 1. Release train Spring Boot compatibility <
Release Train Boot Version

Greenwich

2.1.x

Finchley

2.0.x

Edgware

1.5.x

Dalston

1.5.x