从零开始搭建spring-cloud(0) --springboot与springcloud的关系
擼了今年阿里、頭條和美團的面試,我有一個重要發(fā)現(xiàn).......>>>
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為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見的組件(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智能路由,微代理,控制總線,一次性tokens,全局鎖,選舉,分布式session,集群監(jiān)測)。各個組件之間可以很好的銜接, 使用Spring Cloud開發(fā)人員可以快速地支持實現(xiàn)這些組件服務(wù)和應(yīng)用程序。他們將在任何分布式環(huán)境中都可以很好地運行,即使在開發(fā)人員自己的筆記本電腦,零配置的數(shù)據(jù)中心,以及Cloud Foundry等托管平臺。
?Features 特性
Spring Cloud 更專注于提高組件"開箱即用"的體驗,提供良好的擴展機制。
-
Distributed/versioned configuration??分布式/版本化配置
-
Service registration and discovery?服務(wù)注冊和發(fā)現(xiàn)
-
Routing 路由
-
Service-to-service calls?服務(wù)和服務(wù)之間的調(diào)用
-
Load balancing?負載均衡
-
Circuit Breakers 斷路由
-
Global locks 全局鎖
-
Leadership election and cluster state 領(lǐng)導選舉和集群狀態(tài)
-
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環(huán)境中去,也可以根據(jù)需要映射到其他非Spring應(yīng)用上。
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).
?? ??消息總線,利用分布式消息將服務(wù)和服務(wù)實例連接在一起,用于在一個集群中傳播狀態(tài)的變化?
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集成自己的應(yīng)用,提供了服務(wù)發(fā)現(xiàn),并且使SSO和OAuth2的實現(xiàn)更加簡單。Spring Cloud for Cloudfoundry可以輕松地在Cloud Foundry(平臺即服務(wù))中運行Spring Cloud應(yīng)用程序。 Cloud Foundry具有“服務(wù)”的概念,即“綁定”到應(yīng)用程序的中間件,實質(zhì)上為其提供包含憑據(jù)的環(huán)境變量(例如,用于服務(wù)的位置和用戶名)。
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是一個用于構(gòu)建實現(xiàn)Open Service Broker API的Spring Boot應(yīng)用程序的框架。(為建立管理云托管服務(wù)的服務(wù)代理提供了一個起點。)
Spring Cloud Cluster
Leadership election and common stateful patterns with an abstraction and implementation for Zookeeper, Redis, Hazelcast, Consul.
?? ?提供Leadership選舉,如:Zookeeper, Redis, Hazelcast, Consul等常見狀態(tài)模式的抽象和實現(xiàn)。(基于Zookeeper, Redis, Hazelcast, Consul實現(xiàn)的領(lǐng)導選舉和平民狀態(tài)模式的抽象和實現(xiàn))
Spring Cloud Consul
?? ?Service discovery and configuration management with Hashicorp Consul.
?? ?Consul 是 HashiCorp 公司推出的開源工具,用于實現(xiàn)分布式系統(tǒng)的服務(wù)發(fā)現(xiàn)與配置。(基于Hashicorp Consul實現(xiàn)的服務(wù)發(fā)現(xiàn)和配置管理)
Spring Cloud Security
?? ?Provides support for load-balanced OAuth2 rest client and authentication header relays in a Zuul proxy.
?? ?在Zuul代理中為OAuth2 rest客戶端和認證頭轉(zhuǎn)發(fā)提供負載均衡。
Spring Cloud Sleuth
?? ?Distributed tracing for Spring Cloud applications, compatible with Zipkin, HTrace and log-based (e.g. ELK) tracing.
?? ?分布式Spring Cloud Application服務(wù)鏈路追蹤,兼容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.
?? ?一個云本地程序和操作模型,組成數(shù)據(jù)微服務(wù)在一個結(jié)構(gòu)化的平臺上。管道由Spring Boot應(yīng)用程序組成,使用Spring Cloud Stream或Spring Cloud Task微服務(wù)框架構(gòu)建。 這使得Spring Cloud Data Flow適用于各種數(shù)據(jù)處理用例,從導入/導出到事件流和預(yù)測分析。
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.
?? ?基于Redis,Rabbit,Kafka實現(xiàn)的消息微服務(wù),簡單聲明模型用以在Spring Cloud應(yīng)用中收發(fā)消息。
Spring Cloud Stream App Starters
?? ?Spring Cloud Stream App Starters are Spring Boot based Spring Integration applications that provide integration with external systems.
?? ??基于Spring Boot為外部系統(tǒng)提供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應(yīng)用程序提供創(chuàng)建短運行期微服務(wù)的功能。在Spring Cloud Task中,我們可以靈活地動態(tài)運行任何任務(wù),按需分配資源并在任務(wù)完成后檢索結(jié)果。Tasks是Spring Cloud Data Flow中的一個基礎(chǔ)項目,允許用戶將幾乎任何Spring Boot應(yīng)用程序作為一個短期任務(wù)執(zhí)行。(短生命周期的微服務(wù),為SpringBooot應(yīng)用簡單聲明添加功能和非功能特性。)
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作為服務(wù)發(fā)現(xiàn)和配置管理
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.
?? ?快速和亞馬遜網(wǎng)絡(luò)服務(wù)集成。提供一個便捷的方式與AWS提供的服務(wù)進行交互,而開發(fā)者不需要關(guān)心他的設(shè)計與維護。
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應(yīng)用在各種平臺上連接到后端像數(shù)據(jù)庫和消息經(jīng)紀服務(wù)。
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用戶的依賴項管理。(項目已經(jīng)終止并且在Angel.SR2后的版本和其他項目合并)
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.
?? ?一旦服務(wù)和服務(wù)之間定義了契約,Spring cloud contract會為服務(wù)消費端提供stub的mock server,這樣,用戶就可以只關(guān)注自己的服務(wù)進行測試,同時也不需要寫大量的集成測試。
Spring Cloud Gateway
?? ?Spring Cloud Gateway is an intelligent and programmable router based on Project Reactor.
?? ?Spring Cloud Gateway是Spring Cloud官方推出的第二代網(wǎng)關(guān)框架,取代Zuul網(wǎng)關(guān)。網(wǎng)關(guān)作為流量的,在微服務(wù)系統(tǒng)中有著非常作用,網(wǎng)關(guān)常見的功能有路由轉(zhuǎn)發(fā)、權(quán)限校驗、限流控制等作用。
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應(yīng)用中的方式,為微服務(wù)架構(gòu)下服務(wù)之間的調(diào)用提供了解決方案。首先,利用了OpenFeign的聲明式方式定義Web服務(wù)客戶端;其次還更進一步,通過集成Ribbon或Eureka實現(xiàn)負載均衡的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是一個大型工程項目,由一些列獨立的項目組成,在原則上具有不同的發(fā)布節(jié)奏。為了管理組合,發(fā)布了一個BOM(版本清單),其中包含一組對單個項目的依賴關(guān)系(見下面)。為了避免與子項目混淆,發(fā)布軟件版本串有名稱,而沒有版本。這些名字是按字母順序排列的(所以你可以按時間順序排列),還有倫敦地鐵站的名字(“Angel”是第一個版本,“Brixton”是第二個版本)。當單個項目的發(fā)布點累積到一個臨界量時,或者如果其中有一個臨界bug需要對所有人可用,那么發(fā)布序列將推出名稱以“service release”,以“.SRX”結(jié)尾。,其中“X”是一個數(shù)字。
?
Table 1. Release train Spring Boot compatibility
| Greenwich | 2.1.x |
| Finchley | 2.0.x |
| Edgware | 1.5.x |
| Dalston | 1.5.x |
總結(jié)
以上是生活随笔為你收集整理的从零开始搭建spring-cloud(0) --springboot与springcloud的关系的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 从零开始搭建spring-cloud(1
- 下一篇: Spring Cloud Zuul Th