[Microservice Architecture] Introduction to SpringCloud Components and Concepts (1)

One: What is Microservice (Microservice)

 

 The English name of microservice is Microservice, and the Microservice architecture pattern is to organize the entire web application into a series of small web services. These small web services can be compiled and deployed independently, and communicate with each other through their respective exposed API interfaces. They work with each other to provide functionality to users as a whole, but can be extended independently.

 

  Functions or usage scenarios required by the microservice architecture

        1: We split the entire system into several subsystems according to the business.

 2: Each subsystem can deploy multiple applications, and use load balancing among multiple applications.

 3: A service registry is required, all services are registered in the registry, and load balancing is also achieved through the use of certain policies by the services registered in the registry.

 4: All clients access the background services through the same gateway address. Through routing configuration, the gateway determines which service a URL request is processed by. Load balancing is also used when forwarding requests to services.

 5: Sometimes services also need to access each other. For example, there is a user module, when other services process some services, they need to obtain user data of the user service.

 6: A circuit breaker is needed to deal with timeouts and errors during service calls in a timely manner to prevent the paralysis of the overall system due to a problem with one of the services.

 7: A monitoring function is also required to monitor the time spent in each service call, etc.

  

  The current mainstream microservice frameworks: Dubbo, SpringCloud, thrift, Hessian, etc. At present, most of the domestic small and medium-sized enterprises use Dubbo, and SpringCloud is estimated to be very few, and some developers may not have heard of it.

  

Two: Introduction to the SpringCloud project

 

   springCloud is a set of frameworks for implementing microservices based on SpringBoot. It provides components such as configuration management, service discovery, circuit breakers, intelligent routing, micro-agents, control buses, global locks, decision campaigns, distributed sessions, and cluster state management required for microservice development. the most important is,

  Using it with the spring boot framework will make it very convenient for you to develop cloud services with a microservice architecture.

  

  SpringBoot旨在简化创建产品级的 Spring 应用和服务,简化了配置文件,使用嵌入式web服务器,含有诸多开箱即用微服务功能

  

  相关组件架构图

  

  spring cloud子项目包括:

 

  Spring Cloud Config:配置管理开发工具包,可以让你把配置放到远程服务器,目前支持本地存储、Git以及Subversion。

 

 

  Spring Cloud Bus:事件、消息总线,用于在集群(例如,配置变化事件)中传播状态变化,可与Spring Cloud Config联合实现热部署。

 

  Spring Cloud Netflix:针对多种Netflix组件提供的开发工具包,其中包括Eureka、Hystrix、Zuul、Archaius等。

 

  Netflix Eureka:云端负载均衡,一个基于 REST 的服务,用于定位服务,以实现云端的负载均衡和中间层服务器的故障转移。

 

  Netflix Hystrix:容错管理工具,旨在通过控制服务和第三方库的节点,从而对延迟和故障提供更强大的容错能力。

 

  Netflix Zuul:边缘服务工具,是提供动态路由,监控,弹性,安全等的边缘服务。

 

  Netflix Archaius:配置管理API,包含一系列配置管理API,提供动态类型化属性、线程安全配置操作、轮询框架、回调机制等功能。

 

  Spring Cloud for Cloud Foundry:通过Oauth2协议绑定服务到CloudFoundry,CloudFoundry是VMware推出的开源PaaS云平台。

 

  Spring Cloud Sleuth:日志收集工具包,封装了Dapper,Zipkin和HTrace操作。

 

  Spring Cloud Data Flow:大数据操作工具,通过命令行方式操作数据流。

 

  Spring Cloud Security:安全工具包,为你的应用程序添加安全控制,主要是指OAuth2。

 

  Spring Cloud Consul:封装了Consul操作,consul是一个服务发现与配置工具,与Docker容器可以无缝集成。

 

  Spring Cloud Zookeeper:操作Zookeeper的工具包,用于使用zookeeper方式的服务注册和发现。

 

  Spring Cloud Stream:数据流操作开发包,封装了与Redis,Rabbit、Kafka等发送接收消息。

 

  Spring Cloud CLI:基于 Spring Boot CLI,可以让你以命令行方式快速建立云组件。

  

  SpringCloud特点

       1:约定优于配置

2:开箱即用、快速启动

3:适用于各种环境

4:轻量级的组件

5:组件支持丰富,功能齐全

  

三: SpringBoot了解

 

    Spring Boot让我们的Spring应用变的更轻量化。比如:你可以仅仅依靠一个Java类来运行一个Spring引用。你也可以打包你的应用为jar并通过使用java -jar来运行你的Spring Web应用。

由于SpringCloud依赖SpringBoot,所以在学习SpringCloud框架之前需要了解下SpringBoot。

SpringBoot的主要优点:

  1:为所有Spring开发者更快的入门

  2:开箱即用,提供各种默认配置来简化项目配置

  3:内嵌式容器简化Web项目

  4:没有冗余代码生成和XML配置的要求

  

通过一个helloWorld了解下 地址:http://start.spring.io/

 

       本文主要介绍了相关概念的东西实际操作和应用在后面的文中慢慢介绍

 

 

 

相关资料:中文网:https://springcloud.cc/

                  英文官网:https://spring.io/projects

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326394496&siteId=291194637