Micro Services Migration remember one: opening

 

background

 

  During the new crown epidemic, in-depth study of the micro-architecture-related services, the hands of just a project more suitable for micro-services technology, decided to move the project to the micro-service. Says more suitable, because of better prospects for the project, and the limited investment budget, only five servers, largely registration center, distribution center and other applications will now be deployed on a single server together, after coming up will certainly have to concurrency do load balancing, high availability, and involve WEB end, micro-channel terminal, mobile client, OpenAPI, etc., interface flexibility is very important. As the project evolved, the Party needs to respond quickly and achieve a higher level of application requirements.

   During this outbreak, learning every day + 2 hours, 40 minutes + exercise , learned a lot (10 km to the gym every day because it is not only temporarily give up). Over the years, it has maintained in any case do not let yourself become a death house, fat house, stay home.

Technology Roadmap

 

First, the development framework

The underlying development framework: SpringBoot2.2, SpringCloud2.2

Consumer Client: feign

Database: oracle 12c

JDK:1.8

IDE: Intellj IDEA

Development Environment: win10X64, another installation of a virtual machine deployment consul CentOS7

Other: lomok, spring security, quartz, etc.

Second, the registration center

Alternatively it is: eureka, consul, dubbo, dubboX, zookeeper, Redis like. The project selection consul.

Thoughts: eureka has been closed source, in theory, will not have much impact. After completion consul study found that ACL configuration, service health monitoring seemingly better point. And replace the distribution center, it does not look too much trouble: 1) Change the pom reference. 2) Change YML (properties or configuration) 3) Change springboot start inlet annotation @Enablexxxxx. No choice SpringCloudAlibaba there is no careful study Doub + zookeeper which set the framework.

Reference article: Consul Cluster Setup and Configuration ACL

Third, the center distributed configuration

   There are optional: SpringCloud Config, apollo, etc., and Baidu Ali's distribution center did not go to study. Select the current Head: springcloud config

   The selection, see some articles say config major support git (or svn) deployed, the need for additional server configuration version control, more inclined to Ctrip apollo. After the study, config, supports the deployment of database (jdbc) or local configuration file has been successfully save the configuration information to MySQL.

  Reference article: the Spring Cloud config configuration stored in a database

  There are articles, a detailed comparison of the advantages and disadvantages of open source configuration center: https://blog.csdn.net/zollty/article/details/85166149

Fourth, the micro-service protection framework

  Hystrix achieve downgraded when the avalanche effect service appear, isolation, fuse, protection continuously available throughout the service.

  Reference article: Hystrix Getting Started

Fifth, messaging middleware

  SpringCloudStream integrated RabbitMQ and Kafka, and relatively simple switching, shielding creating switches, routing key, and other technical details of the queue. You have to do is create a channel, binding, publishing, consumer bindings, subscribe to. Rabbit to switch from kafka rely only need to change, the inlet will be able to start.

  Reference article: https://www.cnblogs.com/leeSmall/p/8900518.html

Sixth, the gateway

  zuul achieve reverse proxy, port security filtering. token algorithm plan or project to go into the Common realize, safeguard security interface calls, while each micro-services can also be cited, for secure calls. If the degree of development and debugging convenient, the gateway on the side to achieve a more simple, routine development and debugging can bypass the token mechanism to verify directly in the browser or the postman, the service is only allowed when deploying micro-network access, you can also to a certain extent to protect the security interfaces, but fear the latter modified up trouble. Hesitation.

  Gateway availability and load layer, and the floating IP Nginx plans, plus keepalive, heartbeat and the like to achieve the automatic floating IP downtime to another server. As WEB project accessory uses shared memory. To be honest, the operating system level availability, this one I do not really understand, not much to say, to the professional people to do it.

  zuul Reference: SpringCloud Series Octal: Zuul routing access (basic use of Zuul, Zuul routing function, zuul filter access, Zuul service degradation)

  Availability Reference: Linux High Availability Cluster (HA) Detailed principles

Seven, API management tool

   swagger2.0 achieve restful API interface documentation, reduce the cost of communication with the client, such as micro-channel end.

  Reference article: 5 minutes quickly add Swagger in the SpringCloud

 

Initially set up the directory structure is as follows.

Thoughts: config, nothing to swagger, zuul business, whether or not should not be placed in the same project? Another: the interface and the interface into two different projects in the future considering I only write interface, to others. Interface and the interface to build all kinds of sub-module, through feign called decoupling, as the module to establish what size, not ready yet. Go one step, when a practiced hand.

 

Guess you like

Origin www.cnblogs.com/zhouyu629/p/12286417.html