Spring Cloud basic one

What is Spring Cloud
1. Spring Cloud is a one-stop framework for developing distributed systems, providing developers with a series of toolsets for building distributed systems;
2. Spring Cloud provides developers with rapid building of distributed systems System tools (such as: configuration management, service discovery, circuit breakers, intelligent routing, micro-agents, control buses, global locks, decision-making campaigns, distributed sessions and cluster state management, etc.);
3. The development of distributed systems requires one solution Series of issues of common concern, and using SpringCloud can quickly realize these issues of common concern for distributed development, and easily deploy and run in any distributed environment.
4. Spring Cloud, a one-stop distributed development framework, has been highly praised by the popular "microservice" architecture in recent years and has become the current preferred tool for microservice architecture;
5. Spring Cloud builds microservices based on the Spring Boot framework Architecture, learning Spring Cloud must first learn Spring Boot .

Getting started with Spring Cloud rapid development

1. Build and configure a microservice
(1) Create a Spring Boot project
Note: [1]dependencyManagement: Maven uses the dependencyManagement element to provide a way to manage dependency version numbers. The dependencyManagement element is usually seen in the parent POM at the top of an organization or project. [2] Use the dependencyManagement element in pom.xml to make all references to a dependency in the subproject instead of displaying the listed version number. Maven will go up the parent-child hierarchy until it finds a project with a dependencyManagement element, and then he will use the version number specified in the dependencyManagement element.

spring cloud
2. Eureka Registry
The overall architecture of Spring Cloud
Service Provider: The service provider of the exposed service.
Service Consumer: The service consumer who calls the remote service.
EureKa Server: Service registration center and service discovery center.

 Eureka基础:
       在传统的rpc远程调用框架中,管理每个服务之间的依赖关系比较复杂,所以需要使用服务治理,管理服务与服务之间的依赖关系,可以实现服务调用,负载均衡容错等,实现服务发现与注册。

What is service registration and discovery:
Eureka adopts the CS design architecture. Eureka Server serves as the server for the service registration function. It is the service registration center. Other services in the system use Eureka's client to connect to the Eureka Server and maintain a heartbeat connection. In this way, the maintenance personnel in the system can monitor whether each microservice in the system is operating normally through Eureka Server.
In the service registration and discovery, there is a registry. When the server starts, it will register the current information of its own server, such as service address, mailing address, etc. to the registry in the form of aliases. The other party (consumer|service provider) uses the alias to obtain the actual service communication address from the registry, and then implements local RPC calls. The core design idea of ​​the RPC remote call framework: lies in the registry, because the registry is used to manage a dependency between each service (the concept of service governance). In any RPC remote framework, there is a registry (store the service address) Related information (interface address))

Eureka consists of two components: Eureka Server and Eureka Client
Eureka Server: Provides service registration services. After
each microservice node is started through configuration, it will be registered in Eureka Server, so that
the registry of Eureka Server will store the information of all available service nodes, and the information of service nodes can be intuitive in the interface Seeing that
EurekaClient accesses through the registry
is a JAVA client to simplify the interaction of Eureka Server. The client also has a built-in load balancer that uses a round-Robin load algorithm. After the application starts, it will send a heartbeat to the Eureka Server (the default period is 30 seconds). If Eureka Server does not receive the heartbeat of a node in multiple heartbeat cycles, Eureka Server will remove the service node from the service registry (default 90 seconds)

Guess you like

Origin blog.csdn.net/qq_38428298/article/details/108403046