Spring Cloud Alibaba | 序言
@
1. Spring Cloud Alibaba是什么?
Spring Cloud Alibaba 致力於提供微服務開發的一站式解決方案。此項目包含開發分布式應用微服務的必需組件,方便開發者通過 Spring Cloud 編程模型輕松使用這些組件來開發分布式應用服務。
依托 Spring Cloud Alibaba,您只需要添加一些注解和少量配置,就可以將 Spring Cloud 應用接入阿里微服務解決方案,通過阿里中間件來迅速搭建分布式應用系統。
2. 主要功能
- 服務限流降級: 默認支持 Servlet、Feign、RestTemplate、Dubbo 和 RocketMQ 限流降級功能的接入,可以在運行時通過控制台實時修改限流降級規則,還支持查看限流降級 Metrics 監控。
- 服務注冊與發現: 適配 Spring Cloud 服務注冊與發現標准,默認集成了 Ribbon 的支持。
- 分布式配置管理: 支持分布式系統中的外部化配置,配置更改時自動刷新。
- 消息驅動能力: 基於 Spring Cloud Stream 為微服務應用構建消息驅動能力。
- 分布式事務: 使用 @GlobalTransactional 注解, 高效並且對業務零侵入地解決分布式事務問題。。
- 阿里雲對象存儲: 阿里雲提供的海量、安全、低成本、高可靠的雲存儲服務。支持在任何應用、任何時間、任何地點存儲和訪問任意類型的數據。
- 分布式任務調度: 提供秒級、精准、高可靠、高可用的定時(基於 Cron 表達式)任務調度服務。同時提供分布式的任務執行模型,如網格任務。網格任務支持海量子任務均勻分配到所有 Worker(schedulerx-client)上執行。
- 阿里雲短信服務: 覆蓋全球的短信服務,友好、高效、智能的互聯化通訊能力,幫助企業迅速搭建客戶觸達通道。
3. 組件
-
Sentinel: 把流量作為切入點,從流量控制、熔斷降級、系統負載保護等多個維度保護服務的穩定性。
-
Nacos: 一個更易於構建雲原生應用的動態服務發現、配置管理和服務管理平台。
-
RocketMQ: 一款開源的分布式消息系統,基於高可用分布式集群技術,提供低延時的、高可靠的消息發布與訂閱服務。
-
Dubbo: Apache Dubbo™ 是一款高性能 Java RPC 框架。
-
Seata: 阿里巴巴開源產品,一個易於使用的高性能微服務分布式事務解決方案。
-
Alibaba Cloud ACM: 一款在分布式架構環境中對應用配置進行集中管理和推送的應用配置中心產品。
-
Alibaba Cloud OSS: 阿里雲對象存儲服務(Object Storage Service,簡稱 OSS),是阿里雲提供的海量、安全、低成本、高可靠的雲存儲服務。您可以在任何應用、任何時間、任何地點存儲和訪問任意類型的數據。
-
Alibaba Cloud SchedulerX: 阿里中間件團隊開發的一款分布式任務調度產品,提供秒級、精准、高可靠、高可用的定時(基於 Cron 表達式)任務調度服務。
-
Alibaba Cloud SMS: 覆蓋全球的短信服務,友好、高效、智能的互聯化通訊能力,幫助企業迅速搭建客戶觸達通道。
目前已經開源的組件有:Sentinel, Nacos,RocketMQ,Dubbo
本系列文章目的就是介紹以上開源組件的一些基本使用。
下面簡單介紹一下開源組件和目前的SpringCloud、SpringBoot依賴關系。
4. 版本說明
4.1 版本依賴關系
Spring Cloud Version | Spring Cloud Alibaba Version | Spring Boot Version |
---|---|---|
Spring Cloud Greenwich | 0.9.0.RELEASE | 2.1.X.RELEASE |
Spring Cloud Finchley | 0.2.X.RELEASE | 2.0.X.RELEASE |
Spring Cloud Edgware | 0.1.X.RELEASE | 1.5.X.RELEASE |
- 注意: Spring Cloud Edgware 最低支持 Edgware.SR5 版本
4.2 組件版本關系
Spring Cloud Alibaba Version | Sentinel Version | Nacos Version | RocketMQ Version | Dubbo Version | Seata Version |
---|---|---|---|---|---|
0.9.0.RELEASE or 0.2.2.RELEASE or 0.1.2.RELEASE | 1.5.2 | 1.0.0 | 4.4.0 | 2.7.1 | 0.4.2 |
0.2.1.RELEASE or 0.1.1.RELEASE | 1.4.0 | 0.6.2 | 4.3.1 | ❌ | ❌ |
0.2.0.RELEASE or 0.1.0.RELEASE | 1.3.0-GA | 0.3.0 | ❌ | ❌ | ❌ |
4.3 依賴管理
Spring Cloud Alibaba BOM 包含了它所使用的所有依賴的版本。
4.3.1 RELEASE 版本
4.3.1.1 Spring Cloud Greenwich
如果需要使用 Spring Cloud Greenwich 版本,請在 dependencyManagement 中添加如下內容
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.9.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
4.3.1.2 Spring Cloud Finchley
如果需要使用 Spring Cloud Finchley 版本,請在 dependencyManagement 中添加如下內容
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.2.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
4.3.1.3 Spring Cloud Edgware
如果需要使用 Spring Cloud Edgware 版本,請在 dependencyManagement 中添加如下內容
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
參考:
https://github.com/alibaba/spring-cloud-alibaba/blob/master/README-zh.md
https://github.com/alibaba/spring-cloud-alibaba/wiki