微服務技術棧-2020

# 微服務技術棧

* Author: [HuiFer](https://github.com/huifer)
* Description: 該文簡單介紹微服務技術棧有哪些分別用來做什麼

## 技術棧

### 微服務開發

作用:快速開發服務。

* Spring
* Spring MVC
* Spring Boot

[官網](https://spring.io/),Spring 目前是 JavaWeb 開發人員必不可少的一個框架,SpringBoot 簡化了 Spring 開發的配置目前也是業內主流開發框架。

### 微服務註冊發現

作用:發現服務,註冊服務,集中管理服務

#### Eureka

* Eureka Server : 提供服務註冊服務, 各個節點啓動後,會在 Eureka Server 中進行註冊。
* Eureka Client : 簡化與 Eureka Server 的交互操作
* Spring Cloud Netflix : [GitHub](https://github.com/spring-cloud/spring-cloud-netflix),[文檔](https://cloud.spring.io/spring-cloud-netflix/reference/html/)

#### Zookeeper

> ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.

[Zookeeper](https://github.com/apache/zookeeper) 是一個集中的服務, 用於維護配置信息、命名、提供分佈式同步和提供組服務。

#### Zookeeper 和 Eureka 區別

Zookeeper 保證 CP,Eureka 保證 AP:

* C:數據一致性;
* A:服務可用性;
* P:服務對網絡分區故障的容錯性,這三個特性在任何分佈式系統中不能同時滿足,最多同時滿足兩個。

### 微服務配置管理

作用:統一管理一個或多個服務的配置信息, 集中管理。

#### Disconf

Distributed Configuration Management Platform(分佈式配置管理平臺) , 它是專注於各種分佈式系統配置管理 的通用組件/通用平臺, 提供統一的配置管理服務, 是一套完整的基於 zookeeper 的分佈式配置統一解決方案。

* [GitHub](https://github.com/knightliao/disconf)

#### SpringCloudConfig

* [GitHub](https://github.com/spring-cloud/spring-cloud-config)

#### Apollo

Apollo(阿波羅)是攜程框架部門研發的分佈式配置中心,能夠集中化管理應用不同環境、不同集羣的配置,配置修改後能夠實時推送到應用端,並且具備規範的權限、流程治理等特性,用於微服務配置管理場景。

* [GitHub](https://github.com/ctripcorp/apollo)

### 權限認證

作用:根據系統設置的安全規則或者安全策略, 用戶可以訪問而且只能訪問自己被授權的資源,不多不少。

#### Spring Security

* [官網](https://spring.io/projects/spring-security)

#### apache Shiro

> Apache Shiro™ is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application – from the smallest mobile applications to the largest web and enterprise applications.

* [官網](http://shiro.apache.org/)

### 批處理

作用: 批量處理同類型數據或事物

#### Spring Batch

* [官網](官網)

### 定時任務

> 作用: 定時做什麼.

#### Quartz

* [官網](http://www.quartz-scheduler.org/)

### 微服務調用 (協議)

> 通訊協議

#### Rest

* 通過 HTTP/HTTPS 發送 Rest 請求進行數據交互

#### RPC

* Remote Procedure Call
* 它是一種通過網絡從遠程計算機程序上請求服務,而不需要了解底層網絡技術的協議。RPC 不依賴於具體的網絡傳輸協議,tcp、udp 等都可以。

#### gRPC

* [官網](https://www.grpc.io/)
* > A high-performance, open-source universal RPC framework

  > 所謂 RPC(remote procedure call 遠程過程調用) 框架實際是提供了一套機制,使得應用程序之間可以進行通信,而且也遵從 server/client 模型。使用的時候客戶端調用 server 端提供的接口就像是調用本地的函數一樣。

#### RMI

* Remote Method Invocation
* 純 Java 調用

### 服務接口調用

> 作用:多個服務之間的通訊

#### Feign(HTTP)

Spring Cloud Netflix 的微服務都是以 HTTP 接口的形式暴露的,所以可以用 Apache 的 HttpClient 或 Spring 的 RestTemplate 去調用,而 Feign 是一個使用起來更加方便的 HTTP 客戶端,使用起來就像是調用自身工程的方法,而感覺不到是調用遠程方法。

* [GitHub](https://github.com/OpenFeign/feign)

### 服務熔斷

> 作用: 當請求到達一定閾值時不讓請求繼續.

#### Hystrix

*   > Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems,
services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.

    >

* [GitHub](https://github.com/Netflix/Hystrix)

#### Sentinel

*   > A lightweight powerful flow control component enabling reliability and monitoring for microservices. (輕量級的流量控制、熔斷降級 Java 庫)
* [GitHub](https://github.com/alibaba/Sentinel)

### 服務的負載均衡

> 作用:降低服務壓力, 增加吞吐量

#### Ribbon

* >Spring Cloud Ribbon 是一個基於 HTTP 和 TCP 的客戶端負載均衡工具, 它基於 Netflix Ribbon 實現

  >

* [GitHub](https://github.com/Netflix/ribbon)

#### Nginx

Nginx (engine x) 是一個高性能的 HTTP 和反向代理 web 服務器, 同時也提供了 IMAP/POP3/SMTP 服務

* [GitHub](https://github.com/nginx/nginx)

#### Nginx 與 Ribbon 區別

1. Nginx 屬於服務端負載均衡,Ribbon 屬於客戶端負載均衡.Nginx 作用與 Tomcat,Ribbon 作用與各個服務之間的調用 (RPC)

### 消息隊列

> 作用: 解耦業務, 異步化處理數據

#### Kafka

* [官網](http://kafka.apache.org/)

#### RabbitMQ

* [官網](https://www.rabbitmq.com/)

#### RocketMQ

* [官網](http://rocketmq.apache.org/)

#### activeMQ

* [官網](http://activemq.apache.org/)

### 日誌採集 (elk)

> 作用: 收集各服務日誌提供日誌分析、用戶畫像等

#### Elasticsearch

* [GitHub](https://github.com/elastic/elasticsearch)

#### Logstash

* [GitHub](https://github.com/elastic/logstash)

#### Kibana

* [GitHub](https://github.com/elastic/kibana)

### API 網關

> 作用: 外部請求通過 API 網關進行攔截處理, 再轉發到真正的服務

#### Zuul

> Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.
>

* [GitHub](https://github.com/Netflix/zuul)

### 服務監控

> 作用: 以可視化或非可視化的形式展示出各個服務的運行情況 (CPU、內存、訪問量等)

#### Zabbix

* [GitHub](https://github.com/jjmartres/Zabbix)

#### Nagios

* [官網](https://www.nagios.org/)

#### Metrics

* [官網](https://metrics.dropwizard.io)

### 服務鏈路追蹤

> 作用: 明確服務之間的調用關係

#### Zipkin

* [GitHub](https://github.com/openzipkin/zipkin)

#### Brave

* [GitHub](https://github.com/openzipkin/brave)

### 數據存儲

> 作用: 存儲數據

#### 關係型數據庫

##### MySql

* [官網](https://www.mysql.com/)

##### Oracle

* [官網](https://www.oracle.com/index.html)

##### MsSql

* [官網](https://docs.microsoft.com/zh-cn/sql/?view=sql-server-ver15)

##### PostgreSql

* [官網](https://www.postgresql.org/)

#### 非關係型數據庫

##### Mongodb

* [官網](https://www.mongodb.com/)

##### Elasticsearch

* [GitHub](https://github.com/elastic/elasticsearch)

### 緩存

> 作用: 存儲數據

#### redis

* [官網](https://redis.io/)

### 分庫分表

> 作用: 數據庫分庫分表方案.

#### shardingsphere

* [官網](http://shardingsphere.apache.org/)

#### Mycat

* [官網](http://www.mycat.io/)

### 服務部署

> 作用: 將項目快速部署、上線、持續集成.

#### Docker

* [官網](http://www.docker.com/)

#### Jenkins

* [官網](https://jenkins.io/zh/)

#### Kubernetes(K8s)

* [官網](https://kubernetes.io/)

#### Mesos

* [官網](http://mesos.apache.org/)
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章