Really 666! Ali senior architect stayed up all night purely handwritten 238-page microservice container development practical notes

Preface

With the rapid development of computer technology today, an endless stream of new technologies has promoted the development of productivity and also promoted the progress of the entire society. Software architecture ranges from monolithic architecture to distributed architecture, from SOA architecture to microservice architecture, and then to service grid. Databases spread from Oracle to MySQL, and then to in-memory databases and NoSQL databases. Container orchestration and scheduling technologies have evolved from Mesos, Swarm, and Kubernetes, to the ultimate Kubernetes dominance. "Workers must first sharpen their tools if they want to do well." In the tide of Internet transformation, a comprehensive transformation of ideas, methods, and technology is required. The high reliability, high concurrency, high expansion and low coupling of the Internet architecture jointly create unlimited possibilities for Internet applications.

The core idea of ​​microservices is to split the entire system into multiple independent businesses, and each module can be independently developed, tested, deployed, run, and operated. This low-coupling, high-cohesion flexible feature is exactly what all architecture designers expect. Therefore, the microservice architecture has been favored by large Internet companies in a short period of time and has become a powerful tool for creating complex Internet applications. As the current mainstream container orchestration and scheduling platform, Kubernetes has gradually developed from a new thing to an infrastructure platform that affects global IT technology, and has promoted the popularization and landing of popular technologies such as microservice architecture, cloud native applications, and service grids.

The content of this article is step by step, the concept is clear and clear, from shallow to deep, from easy to difficult, presenting a panoramic picture including microservices, containerization and technical practice for readers.

This article integrates the author's many experiences in the promotion and implementation of microservices in enterprises, not only the theoretical framework is complete, but also typical practical cases are included.

At present, big data, cloud computing, Internet of Things, artificial intelligence, blockchain and other technologies are blooming everywhere. With the wings of 5G technology, we will surely be able to soar!

 

This article will be divided into three parts: catalog, main content, and Daniel's high evaluation of this article. Because of the relatively large content, the editor can only show some knowledge points and catalogs for everyone to introduce, I hope everyone can understand! ! !

Contents of this article

 

The main content of this article

Microservices and Docker container technology are the mainstream technologies commonly used in distributed architectures. Combining Kubernetes' powerful container service orchestration and scheduling capabilities, small and medium-sized enterprises can easily and quickly build their own distributed Internet architecture systems.

This article combines the process and experience of the restructuring of the actual production project to introduce in detail the various aspects of the transition from the monolithic architecture to the microservice containerized distributed architecture, including the selection of microservice development and operation and maintenance technology stacks, Spring Cloud micro Service development, installation and deployment in the offline production environment of Rancher and Kubernetes, containerization and service orchestration of microservices, collection and display of log call chains, system monitoring based on Prometheus, and continuous integration of microservices.

Based on Spring Boot, Spring Cloud, Docker, Rancher, Kubernetes and other technologies, this article mainly provides an overall solution for the microservice containerized production environment from design, development, deployment to operation and maintenance.

Chapter 1 Monolithic Architecture and Microservice Architecture;

This chapter takes an e-commerce order system as the entry point. It first introduces the relevant background of the system, then briefly introduces the characteristics, advantages and disadvantages of the monolithic architecture and microservice architecture, and then introduces the design principles and split principles of microservices. , And finally introduced the principles of microservice development. As a new software architecture model, microservice architecture has its specific design principles and split principles.

 

Chapter 2 Spring Boot Microservice Development;

This chapter mainly introduces the concepts, framework, development, packaging and testing related to microservices. First, the Dubbo service framework and Spring Cloud microservice framework are introduced in detail, and the concepts, characteristics and technology stacks of the two frameworks are introduced and compared in detail. Then it gives a panoramic view of the technology stack of microservice development and operation, and lists the current mainstream technologies related to microservices.

 

Chapter 3 Setting up a microservice operating environment;

This chapter mainly introduces the three environment construction work commonly used in microservices, including development environment, test environment and production environment. The configuration files corresponding to Spring Boot are divided into dev, test, and prod. The main difference between the three is the third-party service IP address, database address, middleware address, and log configuration.

 

Chapter 4 Rancher and Kubernetes offline deployment;

This chapter mainly introduces how to download the installation files of the microservice operating environment, as well as the offline installation of the microservice operating environment Docker, Kubernetes and Rancher. Because Docker and Harbor mirror warehouse involve CA certificates, this chapter also introduces the creation and generation process of CA certificates.

Docker offline installation uses the yum localinstall command to install two rpm installation packages. Harbor is a popular container private image warehouse. Its installation method based on Docker Compose is simple and fast. In addition, installing Harbor requires configuring the CA certificate generated earlier. After Harbor is installed, you can log in to Docker to facilitate subsequent image push and pull operations.

The installation and deployment process of Rancher and Kubernetes is as follows: First, install the Rancher platform, which is used for the management of the Kubernetes cluster; secondly, use the Rancher platform to create and install the Kubernetes cluster to make it easy to add the Control, etcd and Worker nodes of the Kubernetes cluster. simple. After the installation and deployment of the microservice operating environment in this chapter, a containerized operating cluster based on Kubernetes and Rancher can be obtained.

 

Chapter 5 Log Collection;

This chapter introduces the overall end-to-end log collection of the microservice system, including log output, log collection, log collection and processing, log storage, and log display. First, it introduces the log collection model based on Filebeat and ELK, making full use of Elasticsearch's full-text search capabilities and Kibana's rich graphical display capabilities. Secondly, it introduces the log output configuration of microservice based on Spring Boot. The configuration is divided into development environment, test environment and production environment. Finally, according to the log collection model, the log collection, log collection and log display are introduced respectively.

Log collection is first to mount the log directory of the container, and then use Filebeat for log collection. Log collection means that after the logs are collected by Filebeat, they are output to the Logstash component for centralized log format conversion, and then collected into the Elasticsearch component and disk log files. Logs are gathered and stored in disk files for developers and maintainers to use Shell scripts to view the logs. The logs are collected and stored in the Elasticsearch component for Kibana to perform graphical query and display, and can draw and combine rich charts and dashboards.

 

Chapter 6 Call Chain Tracking;

This chapter first introduces the concept of call chain tracing, and expounds the connotation of Trace and Span of service call. Then introduced the Sleuth component and Zipkin component in the Spring Cloud call chain tracking model, and introduced the Spring Cloud call chain tracking model.

Finally, it introduces the Sleuth+Zipkin call chain tracking technology, the configuration in the development environment, the test environment and the production environment, and the storage of the call chain data in the Elasticsearch component. At the same time, it introduces how to graphically display and retrieve the call chain in Zipkin and Kibana. information.

 

Chapter 7 Fuse;

This chapter first introduces the concept of fuse in microservices, and then introduces the characteristics of Hystrix, the fuse in Spring Cloud. Finally, the Maven dependency configuration related to the fuse, the coding of the use of the fuse, and the graphical display and monitoring of the fuse are introduced.

 

Chapter 8 Containerization and Service Orchestration;

This chapter introduces containerization, virtual machines, and service orchestration, with a focus on the construction process of application images in the production environment. Mirroring includes mother mirroring, basic mirroring and application mirroring. At the same time, the basic construction method of application mirroring is introduced.

Service orchestration mainly introduces the Rancher-based Kubernetes container service orchestration platform, combined with the generation practice, introduces how to use Rancher to create and upgrade microservices, how to operate directory mounting, how to configure environment variables, etc. Finally, in combination with the use of Nginx in the production project to do the load balancing of other microservices, it introduces how to create a Config Map, and how to use the Config Map.

 

Chapter 9 System Monitoring;

This chapter first gives an overview of system monitoring, including host monitoring, security monitoring, middleware monitoring, business monitoring, container monitoring, etc. Then it introduces the commonly used monitoring solutions for Kubernetes clusters. Usually, the monitoring system based on Node Exporter, Prometheus and Grafana is selected.

Next, the deployment files of Node Exporter, Prometheus and Grafana components are explained in turn. Finally, combined with the graphical dashboard of the Grafana component, the powerful and rich graphical display capabilities of the Grafana component are introduced.

 

Chapter 10 Continuous Integration Deployment;

This chapter briefly introduces the concept of continuous integration and continuous deployment, as well as the continuous integration deployment model, focusing on the production practice of CICD based on the Kubernetes container platform, Rancher container orchestration platform, and Jenkins pipeline.

 

This [microservice containerized development actual combat] document has a total of 238 pages. If you need a full version, you can forward this article and follow the editor, scan the code below to get it! ! !

Daniel's evaluation of this article

 

Guess you like

Origin blog.csdn.net/bjmashibing001/article/details/113555229