当前位置:网站首页>Grain Mall - environment (p1-p27)

Grain Mall - environment (p1-p27)

2022-07-01 06:33:00 A small salted fish I

1、 Project architecture

 Insert picture description here Separate the front and back development , It is divided into internal network deployment and external network deployment , The Internet is accessible to the public , Deploy front-end projects , You can have a cell phone APP, Computer web page ; The backend cluster is deployed in the intranet , The front end operates on the page and sends requests to the back end , On the way there will be Nginx colony ,Nginx Forward the request to API gateway (springcloud gateway)( The gateway can dynamically route to the specified service according to the current request , See whether the current request wants to call commodity service, shopping cart service or retrieval ), From routing, if there are many requests , You can load balance one of the commodity servers ( Goods and services are copied in multiple copies ), When there is a problem with the commodity server, you can also fuse or degrade the service at the gateway layer ( Use Alibaba's sentinel Components ), The gateway also has other functions, such as authentication and authorization 、 Current limiting ( Release only part to the server ) etc. .

Process after arriving at the server (springboot Service for micro ), Services and services may call each other ( Use OpenFeign Components ), Some requests may be logged in ( be based on OAuth2.0 The certification center of . Security and access springSecurity control )

The service may hold some data or need to use a cache , We use redis colony ( Fragmentation + The sentry cluster ). Persistent usage mysql, Read write separation and sub database sub table .

Message queues are used between services (RabbitMQ), To achieve asynchronous decoupling , Consistency of distributed transactions . Some services may require Full-text Retrieval , Retrieve product information , Use ElaticSearch.

Services may need to access data , Use Alibaba cloud's object storage service OSS.

After the project goes online, in order to quickly locate the problem , Use ELK Processing logs , Use LogStash Collect all kinds of logs in the business , Store logs in ES in , use Kibana Visualize pages from ES Retrieve relevant information from , Help us quickly locate the problem .

In distributed systems , Because each of our services can be deployed on many machines , Services and services may call each other , We need to know where we are , So you need to register all services in the registry . Service finds the location of other services from the registry ( Use Ali Nacos As a registry ).

There are many configurations for each service , In order to change one configuration, the same configuration is changed synchronously , You need to configure the center , Also use Ali's Nacos, The service dynamically fetches configuration from the configuration center .

Service tracking , Track what went wrong with the service call chain , Use springcloud Provided Sleuth、Zipkin、Metrics, Give the information of each service to open source Prometheus Do aggregate analysis , Again by Grafana Make a visual presentation , Provide Prometheus Provided AlterManager Get the alarm information of the service in real time , By text / Inform service developers by mail .

It also provides continuous integration and continuous deployment . After the project is released , Because there are so many micro services , It's too cumbersome to package and deploy each to the server , With continuous integration, developers can submit the modified code to github, Operation and maintenance personnel can use automation tools Jenkins Pipeline take github The code obtained in is packaged into docker Mirror image , Ultimately it is k8s Integrate docker service , Will serve with docker The way the container works .

2、linux Environment building

adopt vitualbox,vagrant Can quickly build a virtual machine , He has a mirror warehouse .
Go to https://www.vagrantup.com/ download vagrant install , Restart the system after installation .cmd Input in vagrant A version means success .
Input vagrant init centos/7, You can initialize a centos7 System .( Note the directory in which this command is executed , His Vagrantfile Just where it was generated )
vagrant up Start the virtual machine environment .
Appears after startup default folder:/cygdrive/c/User/… =>/vagrant. then ctrl+c sign out

The previous page has ssh Account information .vagrant ssh Will connect to the virtual machine . have access to exit sign out
But the network he uses is network address translation NAT( Port forwarding ), If other hosts want to access the virtual machine , Must be windows Port such as 3333 Disconnect the port to the virtual machine, such as 3306. So every time linux Every software in Ryan needs port mapping , inconvenient ,( It can also be in virualBox Set it one by one ). We want to give the virtual machine a fixed ip Address ,windows And virtual machines can interact with each other ping through .
 Insert picture description here

3、

4、

5、

6、

7、

8、

9、

10、

原网站

版权声明
本文为[A small salted fish I]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207010627214417.html