Files
Web_BLS_Heartbeat_Server/README.md
5562288315 revert 2b529baeb3
revert feat: 更新文档和数据库管理逻辑,添加运行模式说明,修复分区表空间设置
2026-03-03 21:28:27 +08:00

76 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Web_BLS_Heartbeat_Server
BLS心跳接收端用于接收并处理Kafka队列中的心跳数据经过解包处理后写入PostgreSQL数据库。
## 功能介绍
- 从Kafka队列接收心跳数据
- 解包和验证心跳数据格式
- 批量处理心跳数据,提高处理效率
- 将处理后的数据写入PostgreSQL数据库
- 支持高并发和自动重连机制
## 技术栈
- **Node.js** (JavaScript) - 运行环境
- **Vite** - 构建工具
- **Kafka** - 消息队列
- **PostgreSQL** - 数据库
## 快速开始
### 安装依赖
```bash
npm install
```
### 配置
复制配置文件模板并根据环境需求修改:
```bash
cp src/config/config.example.js src/config/config.js
```
### 构建
```bash
npm run build
```
### 运行
```bash
# 启动后端Kafka consumer + DB + Redis
npm run start
# 注意npm run dev 是 Vite 开发服务器,不会启动 Kafka consumer
# npm run dev
```
## 项目结构
```
├── src/ # 源代码目录
│ ├── config/ # 配置文件
│ ├── kafka/ # Kafka消息处理
│ ├── processor/ # 心跳数据处理
│ ├── db/ # 数据库操作
│ └── index.js # 项目入口
├── openspec/ # OpenSpec规范文档
├── package.json # 项目依赖
├── vite.config.js # Vite配置
└── README.md # 项目说明
```
## 开发命令
| 命令 | 描述 |
|------|------|
| `npm install` | 安装项目依赖 |
| `npm run build` | 构建项目 |
| `npm run dev` | 启动开发服务器 |
| `npm run test` | 运行测试 |
| `npm run lint` | 代码检查 |