323 lines
11 KiB
Markdown
323 lines
11 KiB
Markdown
# 小鹿超市项目
|
||
|
||
## 配置信息
|
||
|
||
### 服务器硬件配置
|
||
|
||
| 硬件 | 配置 | 数量 | 单价 |
|
||
|-----|----------------------------|----|-------|
|
||
| CPU | E5 2673v3 | 2 | 56 |
|
||
| 主板 | 华南金牌 x99-8D3 双路 | 1 | 580 |
|
||
| 内存 | 三星 32G DDR3 ECC 4R*4 1866L | 2 | 88 |
|
||
| 机箱 | 金河田 凌霜Pro 黑色 | 1 | 148 |
|
||
| 电源 | 鑫谷 GN650 650W 金牌 | 1 | 299 |
|
||
| 硬盘 | 西数 SN530 512G | 1 | 笔记本拆机 |
|
||
| 风扇 | A500 风扇 | 2 | 40 |
|
||
| 显卡 | 亮机卡 | 1 | 20 |
|
||
| | | 总价 | 1415 |
|
||
|
||
### 内网穿透服务器(测试服务器)
|
||
|
||
| 厂商 | 配置 | IP | 时间 | 地区 |
|
||
|-----|---------|----|---------|------|
|
||
| 腾讯云 | 2c2g3m | | 2024-06 | 北京 |
|
||
| 腾讯云 | 4c4g8m | | 2024-06 | 北京 |
|
||
| 华为云 | 2c4g1m | | 2024-02 | 北京 |
|
||
| 阿里云 | 2c2g2m | | 2024-06 | 乌兰察布 |
|
||
| 雨云 | 8c8g80m | | 2024-03 | 洛杉矶 |
|
||
| | | | | |
|
||
|
||
### 服务器参数
|
||
|
||
| 指标 | 参数 |
|
||
|-----------|------|
|
||
| 核心 | 24 |
|
||
| 线程 | 48 |
|
||
| 内存 | 64 |
|
||
| 固态硬盘 | 512G |
|
||
| 机械硬盘(未购买) | |
|
||
| | |
|
||
|
||
### 环境配置需求
|
||
|
||
| | |
|
||
|-------|-----------------|
|
||
| 底层虚拟化 | Debian12 PVE |
|
||
| 集群系统 | CentOS 8 Stream |
|
||
| | |
|
||
|
||
### 集群分配设置
|
||
|
||
| 模块 | 简称 | 核心 | 内存 | 硬盘 | 数量 | IP | 端口 |
|
||
|-------|----------|----|----|-----|----|----|----|
|
||
| 权限模块 | acl | 1 | 1 | 10 | 2 | | |
|
||
| 区域模块 | Sys | 1 | 1 | 10 | 2 | | |
|
||
| 订单模块 | order | 2 | 2 | 10 | 2 | | |
|
||
| 支付模块 | payment | 1 | 2 | 10 | 2 | | |
|
||
| 搜索模块 | search | 2 | 2 | 10 | 2 | | |
|
||
| 用户模块 | user | 1 | 1 | 10 | 2 | | |
|
||
| 商品模块 | product | 1 | 2 | 10 | 2 | | |
|
||
| 区域模块 | sys | 1 | 1 | 10 | 2 | | |
|
||
| 购物车模块 | cart | 2 | 1 | 10 | 2 | | |
|
||
| 优惠券模块 | activity | 1 | 1 | 10 | 2 | | |
|
||
| 网关 | gateway | 1 | 2 | 10 | 3 | | |
|
||
| 后台 | admin | 1 | 2 | 5 | 2 | | |
|
||
| 小程序 | user | | | | | | |
|
||
| 总数 | | 25 | 33 | 110 | 23 | | |
|
||
|
||
### 环境配置
|
||
|
||
| 模块 | 版本 | 核心 | 内存 | 硬盘 | 数量 | IP | |
|
||
|---------------|------------------------------|----|----|----|----|----|------|
|
||
| MySQL | 8.0.30 | | | | | | |
|
||
| Redis | 7.2.4 | | | | | | |
|
||
| Minio | RELEASE.2023-08-16T20-17-30Z | | | | | | |
|
||
| RabbitMQ | 3.12.12 | | | | | | |
|
||
| Elasticsearch | 7.17.7 | | | | | | |
|
||
| Kinbana | 7.17.7 | | | | | | |
|
||
| Nacos | 2.2.3 | | | | | | |
|
||
| | | | | | | | |
|
||
| SkyWalking | 9.7.0 | | | | | | |
|
||
| DevOps | | | | | | | |
|
||
| Gitea | 1.21.3 | | | | | | |
|
||
| Nexus3 | 2023-12-27T07:29 | | | | | | |
|
||
|
||
## 技术栈
|
||
|
||
### 后端技术栈
|
||
|
||
| 核心技术 |
|
||
| :----------------------------------------------------------- |
|
||
| SpringBoot:简化新Spring应用的初始搭建以及开发过程 |
|
||
| SpringCloud:基于Spring Boot实现的云原生应用开发工具,SpringCloud使用的技术:(Spring Cloud Gateway、Spring Cloud OpenFeign、Spring Cloud Alibaba Nacos等) |
|
||
| MyBatis-Plus:持久层框架 |
|
||
| Redis:缓存数据库 |
|
||
| Redisson:基于redis的Java驻内存数据网格,实现分布式锁 |
|
||
| RabbitMQ:消息中间件 |
|
||
| ElasticSearch + Kibana: 全文检索服务器 +可视化数据监控 |
|
||
| ThreadPoolExecutor:线程池来实现异步操作,提高效率 |
|
||
| OSS/MinIO:文件存储服务 |
|
||
| Knife4j(Swagger):Api接口文档工具 |
|
||
| Nginx:负载均衡 |
|
||
| MySQL:关系型数据库 |
|
||
| 微信支付 |
|
||
| 微信小程序 |
|
||
| Docker:容器技术 |
|
||
| DockerFile:管理Docker镜像命令文本 |
|
||
| SkyWalking:链路追踪、日志、监控框架 |
|
||
| |
|
||
| |
|
||
|
||
### 前端技术栈
|
||
|
||
| 核心技术 |
|
||
| ------------------ |
|
||
| UinApp |
|
||
| vue-admin-template |
|
||
| ElementUI |
|
||
| Axios |
|
||
| Node.js |
|
||
| Npm |
|
||
| |
|
||
| |
|
||
| |
|
||
|
||
### 开发工具
|
||
|
||
| 开发工具 | 版本 |
|
||
| ----------------------------- | -------------- |
|
||
| Intellil IDEA Ultimate | 2023.3.2 |
|
||
| DataGrip | 2023.3.2 |
|
||
| WebStorm | 2023.3.2 |
|
||
| HBuilderx | 3.8.12 |
|
||
| Google Chrome | 120.0.6099.216 |
|
||
| Another Redis Desktop Manager | 1.6 |
|
||
| Apifox | 2.3.19 |
|
||
| Parallels Desktop | 18.1.1 |
|
||
| Termius | 8.4.0 |
|
||
| 微信开发者工具 | 1.06.2306020 |
|
||
|
||
### 操作系统
|
||
|
||
| 开发工具 | 版本 |
|
||
|---------------------|--------|
|
||
| Mac OS Ventura | 13.6.3 |
|
||
| Linux CentOS | 7.9 |
|
||
| Linux CentOS Stream | 8 |
|
||
| Linux CentOS Stream | 9 |
|
||
|
||
## 项目环境部署
|
||
|
||
### Mysql 数据库
|
||
|
||
```shell
|
||
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:latest
|
||
```
|
||
|
||
### Redis 缓存
|
||
|
||
```shell
|
||
docker run -itd --name redis -p 6379:6379 redis
|
||
```
|
||
|
||
### RabbitMQ 消息队列
|
||
|
||
```shell
|
||
docker run -d --restart=always -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3.8-management
|
||
|
||
docker exec -it rabbit /bin/bash
|
||
#安装插件
|
||
rabbitmq-plugins enable rabbitmq_management
|
||
```
|
||
|
||
### Nacos 注册中心
|
||
|
||
```shell
|
||
docker run -d --name nacos-server -p 8848:8848 -p 9848:9848 \
|
||
-e MODE=standalone \
|
||
-e JVM_XMS=512m \
|
||
-e JVM_XMX=512m \
|
||
-v /logs/nacos:/home/nacos/logs \
|
||
nacos/nacos-server:v2.2.3
|
||
```
|
||
|
||
### ES + Kibana 分词器
|
||
|
||
```shell
|
||
docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \
|
||
-e "discovery.type=single-node" \
|
||
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
|
||
-d elasticsearch:7.8.0
|
||
|
||
docker exec -it elasticsearch /bin/bash
|
||
|
||
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip
|
||
|
||
docker restart elasticsearch
|
||
|
||
docker run -d --name kibana --link elasticsearch:elasticsearch -p 5601:5601 kibana:7.8.0
|
||
```
|
||
|
||
### GrayLog 日志框架 (已弃用,日志服务整合到 SkyWalking)
|
||
|
||
```shell
|
||
#部署Elasticsearch
|
||
docker run -d \
|
||
--name elasticsearch \
|
||
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
|
||
-e "discovery.type=single-node" \
|
||
-v es-data:/usr/share/elasticsearch/data \
|
||
-v es-plugins:/usr/share/elasticsearch/plugins \
|
||
--privileged \
|
||
-p 9200:9200 \
|
||
-p 9300:9300 \
|
||
elasticsearch:7.17.5
|
||
|
||
#部署MongoDB(使用之前部署的服务即可)
|
||
docker run -d \
|
||
--name mongodb \
|
||
-p 27017:27017 \
|
||
--restart=always \
|
||
-v mongodb:/data/db \
|
||
-e MONGO_INITDB_ROOT_USERNAME=xlcs \
|
||
-e MONGO_INITDB_ROOT_PASSWORD=123321 \
|
||
mongo:4.4
|
||
|
||
#部署
|
||
docker run \
|
||
--name graylog \
|
||
-p 9000:9000 \
|
||
-p 12201:12201/udp \
|
||
-e GRAYLOG_HTTP_EXTERNAL_URI=http://<IP>:9000/ \
|
||
-e GRAYLOG_ELASTICSEARCH_HOSTS=http://<IP>:9200/ \
|
||
-e GRAYLOG_ROOT_TIMEZONE="Asia/Shanghai" \
|
||
-e GRAYLOG_WEB_ENDPOINT_URI="http://<IP>:9000/:9000/api" \
|
||
-e GRAYLOG_PASSWORD_SECRET="somepasswordpepper" \
|
||
-e GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \
|
||
-e GRAYLOG_MONGODB_URI=mongodb://xlcs:123321@<IP>:27017/admin \
|
||
-d \
|
||
graylog/graylog:4.3
|
||
```
|
||
|
||
### SkyWalking 链路追踪、日志、监控框架
|
||
|
||
```yaml
|
||
version: "3"
|
||
services:
|
||
elasticsearch:
|
||
image: elasticsearch:8.4.2
|
||
container_name: elasticsearch
|
||
ports:
|
||
- "9200:9200"
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"] #⼼跳检测,成功之后不再执⾏后⾯的退出
|
||
interval: 60s #⼼跳检测间隔周期
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 60s #⾸次检测延迟时间
|
||
environment:
|
||
discovery.type: single-node #单节点模式
|
||
ingest.geoip.downloader.enabled: "false"
|
||
bootstrap.memory_lock: "true"
|
||
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
|
||
TZ: "Asia/Shanghai"
|
||
xpack.security.enabled: "false" #单机模式
|
||
ulimits:
|
||
memlock:
|
||
soft: -1
|
||
hard: -1
|
||
skywalking-oap:
|
||
image: apache/skywalking-oap-server:9.4.0
|
||
container_name: skywalking-oap
|
||
depends_on:
|
||
elasticsearch:
|
||
condition: service_healthy
|
||
links:
|
||
- elasticsearch
|
||
environment:
|
||
SW_HEALTH_CHECKER: default
|
||
SW_STORAGE: elasticsearch
|
||
SW_STORAGE_ES_CLUSTER_NODES: 124.70.87.134:9200
|
||
JAVA_OPTS: "-Xms2048m -Xmx2048m"
|
||
TZ: Asia/Shanghai
|
||
SW_TELEMETRY: prometheus
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "/skywalking/bin/swctl ch"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 10s
|
||
restart: on-failure
|
||
ports:
|
||
- "11800:11800"
|
||
- "12800:12800"
|
||
skywalking-ui:
|
||
image: apache/skywalking-ui:9.4.0
|
||
container_name: skywalking-ui
|
||
depends_on:
|
||
skywalking-oap:
|
||
condition: service_healthy
|
||
links:
|
||
- skywalking-oap
|
||
ports:
|
||
- "8080:8080"
|
||
environment:
|
||
SW_OAP_ADDRESS: http://124.70.87.134:12800
|
||
SW_HEALTH_CHECKER: default
|
||
TZ: Asia/Shanghai
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -sf http://localhost:8080 || exit 1"] #⼼跳检测,成功之后不再执⾏后⾯的退出
|
||
interval: 60s #⼼跳检测间隔周期
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 60s #⾸次检测延迟时间
|
||
```
|
||
|
||
## 开发需求
|
||
|
||
| | | |
|
||
|------|------|------|
|
||
| | | |
|
||
| | | |
|
||
| | | |
|