openclaw/CLUSTER-CONFIG-SUMMARY.md
Claude Code 286f6f43a7 docs: add comprehensive cluster configuration
Add complete Moltbot distributed cluster setup:
- 6 documentation files (33KB)
- Deployment tools and scripts
- Configuration templates
- Status dashboard

See CLUSTER-CONFIG-SUMMARY.md for details.
2026-01-29 16:43:13 +08:00

325 lines
8.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.

# Moltbot 分布式集群配置完成报告
## 📋 配置概览
**配置日期**: 2026-01-29
**版本**: v1.0
**状态**: ✅ 核心配置已完成
---
## ✅ 已完成的配置
### 阶段1: 基础架构 (已完成)
#### 服务器 (38.14.254.51)
- ✅ Gateway 服务运行 (端口 18789)
- ✅ systemd 自动启动配置
- ✅ Redis 服务运行 (端口 6379)
- ✅ PostgreSQL 数据库运行
- ✅ 防火墙端口开放 (18789, 18792, 6379)
#### 桌面 (本地)
- ✅ Gateway 本地模式配置
- ✅ 浏览器自动化工具配置
- ✅ 桌面快捷方式创建
- ✅ Node.js v22.12.0 环境
---
### 阶段2: 高级功能 (已完成)
#### 1. Redis 会话共享
```json
{
"state": {
"backend": "redis",
"redis": {
"host": "38.14.254.51",
"port": 6379,
"password": "moltbot-redis-2024",
"db": 0
}
}
}
```
**功能**:
- ✅ 跨设备会话同步
- ✅ 统一对话历史
- ✅ 实时状态共享
- ✅ 支持离线队列
#### 2. 负载均衡
```json
{
"gateway": {
"loadBalancing": {
"enabled": true,
"strategy": "round-robin",
"agents": {
"maxConcurrent": 5,
"queueTimeout": 30000
}
}
}
}
```
**功能**:
- ✅ 请求分发策略
- ✅ 并发限制
- ✅ 队列管理
- ✅ 优先本地处理
#### 3. 笔记本部署包
- ✅ 配置模板创建 (`notebook-setup.json`)
- ✅ 安装脚本创建 (`notebook-setup.bat`)
- ✅ 部署文档创建 (`NOTEBOOK-DEPLOY.md`)
- ✅ 完整代码打包 (`moltbot-notebook-deploy.tar.gz` - 836MB)
**部署包位置**: `D:\workspace\moltbot\moltbot-notebook-deploy.tar.gz`
---
### 阶段3: 运维管理 (已完成)
#### 1. 监控系统
**监控脚本**: `/opt/moltbot-monitoring/health-check.sh`
**检查项目**:
- ✅ Gateway 服务状态
- ✅ Redis 连接状态
- ✅ PostgreSQL 运行状态
- ✅ 磁盘空间使用
- ✅ 内存使用情况
**监控频率**: 每 5 分钟自动检查
#### 2. 告警系统
**告警方式**:
- ✅ 日志记录 (`/var/log/moltbot-health.log`)
- ✅ 自动服务重启
- ✅ 关键问题告警文件
- ⏳ 邮件通知 (可扩展)
#### 3. 备份系统
**备份脚本**: `/opt/moltbot-monitoring/backup.sh`
**备份策略**:
-**每日备份**: 配置、Redis、PostgreSQL、会话数据
-**每周备份**: 每周日创建完整快照
-**自动清理**: 删除 7 天前的每日备份4 周前的周备份
-**日志记录**: `/var/log/moltbot-backup.log`
**备份位置**:
```
/opt/moltbot-backup/
├── daily/ # 每日备份 (保留7天)
├── weekly/ # 每周备份 (保留4周)
└── monthly/ # 月度备份 (手动)
```
#### 4. 日志管理
**日志轮转配置**: `/etc/logrotate.d/moltbot`
**策略**:
- ✅ 每日轮转
- ✅ 保留 30 天
- ✅ 自动压缩
- ✅ 延迟压缩
#### 5. 数据同步配置
**同步配置文件**: `D:\workspace\moltbot\sync-config.json`
**同步内容**:
- ✅ 会话数据 (5秒间隔)
- ✅ 内存数据 (10秒间隔)
- ✅ 工作区文件 (30秒间隔)
- ✅ 离线队列支持
---
## 📊 系统架构
```
┌─────────────────────────────────────────────────────────────┐
│ Moltbot 分布式集群 │
└─────────────────────────────────────────────────────────────┘
┌──────────────────┐ ┌──────────────────┐
│ 高配服务器 │ │ 本地台式机 │
│ 38.14.254.51 │ │ (你的电脑) │
├──────────────────┤ ├──────────────────┤
│ • Gateway (主) │◄────────┤ • Gateway (从) │
│ • Redis (共享) │ 会话 │ • 浏览器工具 │
│ • PostgreSQL │ 同步 │ • 本地文件访问 │
│ • 监控 + 备份 │ └──────────────────┘
└──────────────────┘
│ ┌──────────────────┐
│ │ 笔记本 1 │
│ ├──────────────────┤
│ │ • Gateway │
│ │ • Redis 客户端 │
│ │ ○ 待部署 │
│ └──────────────────┘
│ ┌──────────────────┐
│ │ 笔记本 2 │
│ ├──────────────────┤
│ │ • Gateway │
│ │ • Redis 客户端 │
│ │ ○ 待部署 │
│ └──────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 共享存储层 │
├─────────────────────────────────────────────────────────────┤
│ • Redis: 会话状态、缓存、实时同步 │
│ • PostgreSQL: 持久化数据、历史记录 │
│ • 文件系统: 备份、日志、配置文件 │
└─────────────────────────────────────────────────────────────┘
```
---
## 🔧 配置文件位置
### 服务器
```bash
# 配置文件
/root/.clawdbot/moltbot.json
# 服务配置
/etc/systemd/system/moltbot.service
# Redis 配置
/etc/redis/redis.conf
# 监控脚本
/opt/moltbot-monitoring/health-check.sh
/opt/moltbot-monitoring/backup.sh
# 备份目录
/opt/moltbot-backup/
# 日志文件
/var/log/moltbot-health.log
/var/log/moltbot-backup.log
```
### 桌面
```bash
# 配置文件
C:\Users\15622\.clawdbot\moltbot.json
# 工作目录
D:\workspace\moltbot\
# 快捷方式
C:\Users\15622\Desktop\Moltbot.bat
C:\Users\15622\Desktop\Ask Moltbot.bat
# 部署包
D:\workspace\moltbot\moltbot-notebook-deploy.tar.gz
```
---
## 🚀 下一步操作
### 1. 部署笔记本 (待完成)
**步骤**:
1.`D:\workspace\moltbot\moltbot-notebook-deploy.tar.gz` 传输到笔记本
2. 在笔记本上解压到 `C:\moltbot\`
3. 运行 `notebook-setup.bat` 安装脚本
4. 双击桌面 `Moltbot.bat` 启动
**参考文档**: `D:\workspace\moltbot\NOTEBOOK-DEPLOY.md`
### 2. 验证集群功能
**测试清单**:
- [ ] 服务器 Gateway 运行正常
- [ ] 桌面 Gateway 运行正常
- [ ] Redis 连接测试
- [ ] 会话同步测试
- [ ] 备份系统测试
- [ ] 监控告警测试
### 3. 可选优化
**性能优化**:
- 配置 CDN 加速 API 请求
- 优化 Redis 内存配置
- 调整负载均衡参数
**安全加固**:
- 配置 SSL/TLS 证书
- 启用 Redis ACL
- 配置防火墙白名单
**功能扩展**:
- 集成邮件告警
- 添加 Webhook 通知
- 配置日志分析工具
---
## 📖 相关文档
- **SETUP.md**: 基础配置说明
- **NOTEBOOK-DEPLOY.md**: 笔记本部署指南
- **CLUSTER-CONFIG-SUMMARY.md**: 本文档
- **status-dashboard.html**: 可视化监控面板
---
## 🆘 故障排查
### 常见问题
**1. Gateway 无法启动**
```bash
# 检查 Node.js 版本
node --version # 需要 v22+
# 检查端口占用
netstat -an | grep 18789
# 查看日志
journalctl -u moltbot -f
```
**2. Redis 连接失败**
```bash
# 测试连接
redis-cli -h 38.14.254.51 -p 6379 -a moltbot-redis-2024 ping
# 检查防火墙
telnet 38.14.254.51 6379
```
**3. 会话不同步**
- 确认所有设备使用相同的 Redis 配置
- 检查 Redis 密码是否正确
- 重启 Gateway 服务
---
## 📞 技术支持
- **配置文件**: `D:\workspace\moltbot\`
- **日志位置**: `/var/log/moltbot*.log` (服务器)
- **备份位置**: `/opt/moltbot-backup/` (服务器)
- **监控面板**: 打开 `status-dashboard.html`
---
**配置完成时间**: 2026-01-29
**系统状态**: ✅ 核心功能已就绪
**待完成**: 笔记本部署