springcloud(一):Spring Cloud

After studying for a while, Spring Boot is ready to move to Spring Cloud, and the company's architecture and projects have fully embraced Spring Cloud. After using it for a period of time, I found that Spring Cloud reduces the requirements for large-scale system construction from the technical architecture, enabling us to build an efficient, distributed, and fault-tolerant platform at a very low cost (technology or hardware), but Spring Cloud also Not without its drawbacks, small standalone projects are not suitable for use.

What the hell is Spring Cloud?

Spring Cloud is an ordered collection of a series of frameworks. It uses the development convenience of Spring Boot to subtly simplify the development of distributed system infrastructure, such as service discovery registration, configuration center, message bus, load balancing, circuit breaker, data monitoring, etc., all of which can be done in the Spring Boot development style. to one-click launch and deployment. Spring does not repeat the manufacture of wheels, it just combines the more mature and practical service frameworks developed by various companies, and re-encapsulates the complex configuration and implementation principles through Spring Boot style. The author has left a set of distributed system development toolkits that are easy to understand, easy to deploy and easy to maintain.

Microservices are service units that can be deployed independently, scaled horizontally, and accessed independently (or have independent databases). Springcloud is the big housekeeper of these microservices. After adopting the architecture of microservices, the number of projects will be very large. Springcloud does Because the big housekeeper needs to manage these microservices, naturally many younger brothers are needed to help.

The main brothers are: Spring Cloud Config, Spring Cloud Netflix (Eureka, Hystrix, Zuul, Archaius...), Spring Cloud Bus, Spring Cloud for Cloud Foundry, Spring Cloud Cluster, Spring Cloud Consul, Spring Cloud Security, Spring Cloud Sleuth, Spring Cloud Data Flow, Spring Cloud Stream, Spring Cloud Task, Spring Cloud Zookeeper, Spring Cloud Connectors, Spring Cloud Starters, Spring Cloud CLI, each little brother has his own unique skills and martial arts. Let's introduce them one by one.

Core member

Spring Cloud Netflix

This is a big boss, and its status is second only to the boss. The boss relies on it for various services, integrates with various Netflix OSS components, and forms the core of microservices. Its little brothers mainly include Eureka, Hystrix, Zuul, Archaius... too many

Netflix Eureka

Service Center, Cloud Service Discovery, a REST-based service for locating services for cloud middle-tier service discovery and failover. This is springcloud's most arrogant younger brother, the service center. Any younger brother needs support from other younger brothers and needs to get it from here. Similarly, if you have any unique martial arts, please report it quickly, so that other younger brothers can call it later; its advantage is that you You don't need to find any kind of support directly, you just need to go to the service center to get it, and you don't need to know where the other supporters are, or a few younger brothers to support, anyway, just use it, the service center will ensure stability and quality.

Netflix Hystrix

Circuit breaker, a fault-tolerant management tool, is designed to control the nodes of services and third-party libraries through a circuit breaker mechanism, thereby providing stronger fault tolerance for delays and failures. For example, suddenly a certain younger brother is ill, but you still need its support, and after calling it for a long time, it does not respond, but you do not know, and have been waiting for this response; it is possible that other younger brothers are also calling your martial arts skills, then When there are many requests, serious blocking will occur and affect the boss's overall plan. At this time, Hystrix comes in handy. When Hystrix finds that a certain younger brother is not in an unstable state, it immediately takes it offline, and asks other younger younger brothers to come up, or tell you that there is no need to wait. This younger brother will definitely not be able to do it today, why should he hurry up? Why don't you stop queuing here.

Netflix Zuul

Zuul is a framework for providing dynamic routing, monitoring, elasticity, security and other edge services on cloud platforms. Zuul is equivalent to being the front door for all requests to the backend of the web site on the device and the Netflix streaming app. When other sects come to look for the eldest brother to do business, they must first pass through zuul to see if there is anyone with a knife or something to intercept them, or if they need to find the younger brother to bring them directly.

Netflix Archaius

Configuration management APIs, including a series of configuration management APIs, provide functions such as dynamically typed properties, thread-safe configuration operations, polling frameworks, and callback mechanisms. The configuration can be dynamically obtained. The principle is to read the content from the configuration source every 60s (default, configurable), so that the modified content can take effect without restarting the service after modifying the configuration file. The premise is that the API of archaius is used to read.

Spring Cloud Config

Commonly known as the configuration center, the configuration management toolkit allows you to put the configuration on the remote server and centrally manage the cluster configuration. Currently, it supports local storage, Git and Subversion. That is, in the future, everyone's weapons, guns and other things will be concentrated together, don't bring your own, it will be convenient for unified management and upgrade of equipment in the future.

Spring Cloud Bus

An event, message bus for propagating state changes across the cluster (e.g., configuration change events), enabling hot deployment in conjunction with Spring Cloud Config. It is equivalent to Dai Zong, the god-travel Taibao who traveled 800 miles a day in the Water Margin, ensuring that the news between the younger brothers remains unblocked.

Spring Cloud for Cloud Foundry

Cloud Foundry is the industry's first open source PaaS cloud platform launched by VMware. It supports multiple frameworks, languages, runtime environments, cloud platforms and application services, enabling developers to deploy and expand applications in seconds. No need to worry about any infrastructure issues

In fact, it is a set of solutions integrated with Cloud Foundry, which embraces the thigh of Cloud Foundry.

Spring Cloud Cluster

Spring Cloud Cluster will replace Spring Integration. Provides basic functional support required by clusters in distributed systems, such as: election, cluster state consistency, global locks, tokens and other common state patterns abstraction and implementation.

If you organize different gangs into a unified whole, Spring Cloud Cluster has provided you with many tools that are convenient to organize into a unified whole.

Spring Cloud Consul

Consul is a service software that supports multi-data center distributed and highly available service discovery and configuration sharing. It was developed by HashiCorp in Go language and is open source based on the Mozilla Public License 2.0 protocol. Consul supports health checks and allows HTTP and DNS protocols Call the API to store key-value pairs.

Spring Cloud Consul encapsulates the operation of Consul, a service discovery and configuration tool that can be seamlessly integrated with Docker containers.

other brothers

Spring Cloud Security

A security toolkit based on spring security to add security controls to your application. This little brother is very arrogant and is responsible for the security of the entire gang, setting up different sects to access specific resources, and can't leak the secret book Sunflower Collection.

Spring Cloud Sleuth

The log collection toolkit, which encapsulates Dapper and log-based tracing and Zipkin and HTrace operations, implements a distributed tracing solution for SpringCloud applications.

Spring Cloud Data Flow

  • Data flow is a unified programming model and managed service for developing and executing large-scale data processing patterns including ETL, batch operations, and continuous operations.

  • Spring Cloud data flow is a cloud-native orchestration service for microservice programs that are composable in modern runtime environments. Using Spring Cloud data flow, developers can create and orchestrate data pipelines for common use cases like data extraction, real-time analytics, and data import/export.

  • Spring Cloud data flow is a redesign of spring XD based on native cloud. The goal of this project is to simplify the development of big data applications. The refactoring of Spring XD's stream processing and batch modules is based on Spring Boot's stream and task/batch microservice programs respectively. These programs are now automated deployment units and they natively support modern runtimes like Cloud Foundry, Apache YARN, Apache Mesos, and Kubernetes.

  • Spring Cloud data flow provides a set of models and best practices for microservice-based distributed stream processing and batch data channels.

Spring Cloud Stream

Spring Cloud Stream is a framework for creating message-driven microservice applications. Spring Cloud Stream is based on Spring Boot and is used to build stand-alone/industrial spring applications, using spring integration to provide connections with message brokers. The data flow operation development package encapsulates sending and receiving messages with Redis, Rabbit, Kafka, etc.

A business will involve multiple tasks, and the tasks are triggered by events. This is what Spring Cloud stream does.

Spring Cloud Task

Spring Cloud Task mainly solves the task management and task scheduling of short-lived microservices. For example, some scheduled tasks run once at night, or a certain data analysis runs several times temporarily.

Spring Cloud Zookeeper

ZooKeeper is a distributed, open source distributed application coordination service, an open source implementation of Google's Chubby, and an important component of Hadoop and Hbase. It is a software that provides consistent services for distributed applications. The functions provided include: configuration maintenance, domain name service, distributed synchronization, group service, etc. The goal of ZooKeeper is to encapsulate complex and error-prone key services, and provide users with an easy-to-use interface and a system with high performance and stable functions.

A toolkit for operating Zookeeper, which is used for service discovery and configuration management using the zookeeper method, and embraces the thigh of Zookeeper.

Spring Cloud Connectors

Spring Cloud Connectors simplifies the process of connecting to services and obtaining operations from the cloud platform. It has strong extensibility and can use Spring Cloud Connectors to build your own cloud platform.

It is convenient for cloud applications to connect to the backend in various PaaS platforms, such as: database and message broker services.

Spring Cloud Starters

A Spring Boot-style startup project that provides out-of-the-box dependency management for Spring Cloud.

Spring Cloud CLI

Based on the Spring Boot CLI, it allows you to quickly build cloud components from the command line.

What is the relationship with Spring Boot

Spring Boot is a set of rapid configuration scaffolding for Spring, which can quickly develop a single microservice based on Spring Boot. Spring Cloud is a cloud application development tool based on Spring Boot; Spring Boot focuses on a single individual that is fast and easy to integrate, and Spring Cloud is a Pay attention to the global service governance framework; Spring Boot uses the concept that the default is greater than the configuration. Many integration solutions have been selected for you, and you can not configure it without configuration. A large part of Spring Cloud is implemented based on Spring Boot, which may not be based on Is it Spring Boot? Can not.

Spring Boot can use development projects independently of Spring Cloud, but Spring Cloud is inseparable from Spring Boot, which is a dependency.

The relationship between spring -> spring boot > Spring Cloud.

Advantages of Spring Cloud

There are so many frameworks for microservices, such as: dubbo, Kubernetes, why use Spring Cloud?

  • Produced by the spring family, spring is unmatched in the enterprise-level development framework, and has a great background, which can ensure subsequent updates and improvements. Like dubbo is almost dead now
  • Having Spring Boot as an independent leader can save a lot of work, and Spring Boot does a good job of doing things big and small.
  • As a big guy in microservice governance, he considers it very comprehensively, and almost all aspects of service governance are considered, which is convenient for development out of the box.
  • Spring Cloud is very active, with rich tutorials, and it is easy to find solutions when encountering problems
  • A few lines of code can easily complete various platform functions of fuse, balance responsibility, and service center

Spring Cloud is a boon for small and medium-sized Internet companies, because such companies often do not have the strength or sufficient capital to develop their own distributed system infrastructure. Using Spring Cloud's one-stop solution can easily deal with business While developing, the development cost is greatly reduced. At the same time, with the popularity of microservice architecture and Docker container concept in recent years, Spring Cloud will also have a place in the increasingly "cloud" software development style in the future, especially in the current variety of distributed solutions. It provides a standardized, full-stop technical solution, which may be comparable to the birth of the current Servlet specification, effectively promoting the technical level of the server-side software system.

Guess you like

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