新增備份(已部署到 110,首次執行全部通過): - backup-langfuse.sh: Langfuse AI 追蹤/評測 DB (7238 traces) - backup-monitoring.sh: Prometheus + Grafana + Alertmanager volumes + configs - backup-signoz.sh: SignOz ClickHouse + SQLite (分散式追蹤/日誌) - backup-open-webui.sh: Open-WebUI LLM 對話紀錄 (SSH 188 volume) - backup-clawbot.sh: ClawBot Redis 狀態/快取 (SSH 188 volume) - backup-all.sh v3.0: 整合至 9/9 服務 告警機制: - common.sh: notify_clawbot 改用 /webhook/custom 正確格式 - failed → severity:critical → Telegram 🔴 立即告警 - 告警測試通過:{"status":"ok","alert_id":"878c4c59..."} GFS 保留:30日/12週/24月 (AWOOOI 額外 28h 高頻) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
124 lines
4.7 KiB
Markdown
124 lines
4.7 KiB
Markdown
# BACKUP-STATUS.md — 備份狀態總覽
|
||
|
||
> 2026-04-05 Claude Code: 首席架構師完整盤點 — 全服務全自動化 + 告警機制
|
||
> 備份中心:192.168.0.110 (`/backup/`) — Restic + GFS 祖父子策略
|
||
|
||
---
|
||
|
||
## 備份全景圖(全部自動化)
|
||
|
||
| # | 資料類型 | 備份腳本 | 排程 | 最大損失 | 狀態 |
|
||
|---|---------|---------|------|---------|------|
|
||
| 1 | Gitea (DB + 倉庫) | `backup-gitea.sh` | 每日 02:00 | 24h | ✅ |
|
||
| 2 | MOMO PostgreSQL | `backup-momo.sh` | 每日 02:00 | 24h | ✅ |
|
||
| 3 | Harbor (Registry + DB) | `backup-harbor.sh` | 每日 02:00 | 24h | ✅ |
|
||
| 4 | **AWOOOI PostgreSQL (完整)** | **`backup-awoooi.sh`** | **每日 02:00** | **6h** | **✅** |
|
||
| 4h | **AWOOOI PostgreSQL (高頻)** | **`backup-awoooi-frequent.sh`** | **08/14/20:00** | **6h** | **✅** |
|
||
| 5 | **Langfuse (AI 追蹤/評測)** | **`backup-langfuse.sh`** | **每日 02:00** | **24h** | **✅** |
|
||
| 6 | **Monitoring (Prometheus/Grafana/Alertmanager)** | **`backup-monitoring.sh`** | **每日 02:00** | **24h** | **✅** |
|
||
| 7 | **SignOz (ClickHouse 追蹤/日誌)** | **`backup-signoz.sh`** | **每日 02:00** | **24h** | **✅** |
|
||
| 8 | **Open-WebUI (LLM 對話紀錄)** | **`backup-open-webui.sh`** | **每日 02:00** | **24h** | **✅** |
|
||
| 9 | **ClawBot Redis (狀態/快取)** | **`backup-clawbot.sh`** | **每日 02:00** | **24h** | **✅** |
|
||
| - | K8s 資源 (全命名空間) | Velero + MinIO | 每日 02:00 | 24h | ✅ |
|
||
|
||
**備份總控**:`/backup/scripts/backup-all.sh` v3.0 — 統一執行 9 個備份
|
||
|
||
---
|
||
|
||
## 告警機制
|
||
|
||
備份失敗自動推送 Telegram(透過 ClawBot `/webhook/custom`):
|
||
|
||
| 狀態 | Severity | Telegram 收到 |
|
||
|------|---------|--------------|
|
||
| `success` | info | ✅ 正常通知 |
|
||
| `warning` | warning | ⚠️ 黃色警告 |
|
||
| `failed` | **critical** | 🔴 **立即告警** |
|
||
|
||
**告警端點**:`http://192.168.0.188:8088/api/v1/webhook/custom`
|
||
**測試指令**:
|
||
```bash
|
||
source /backup/scripts/common.sh
|
||
notify_clawbot "failed" "backup-test" "測試告警" 0
|
||
```
|
||
|
||
---
|
||
|
||
## GFS 保留策略
|
||
|
||
| 級別 | 保留數量 | 覆蓋時間 |
|
||
|------|---------|---------|
|
||
| 每小時(AWOOOI 高頻) | 28 份 | 最近 7 天 |
|
||
| 每日 | 30 份 | 最近 30 天 |
|
||
| 每週 | 12 份 | 最近 3 個月 |
|
||
| 每月 | 24 份 | 最近 **2 年** |
|
||
|
||
---
|
||
|
||
## Crontab 完整排程(110)
|
||
|
||
```
|
||
0 2 * * * backup-all.sh ← 9 個服務完整備份
|
||
0 8,14,20 * * * backup-awoooi-frequent.sh ← AWOOOI 高頻(每 6 小時)
|
||
0 6 * * * backup-status.sh ← 備份狀態報告
|
||
```
|
||
|
||
---
|
||
|
||
## 備份架構
|
||
|
||
```
|
||
192.168.0.110 (/backup/scripts/backup-all.sh) 每日 02:00
|
||
├── [1/9] backup-gitea.sh → gitea dump → /backup/gitea
|
||
├── [2/9] backup-momo.sh → SSH 188 pg_dump momo → /backup/momo
|
||
├── [3/9] backup-harbor.sh → harbor dump → /backup/harbor
|
||
├── [4/9] backup-awoooi.sh → SSH 188 pg_dump awoooi_prod/dev/k3s → /backup/awoooi
|
||
├── [5/9] backup-langfuse.sh → docker exec langfuse-db pg_dump → /backup/langfuse
|
||
├── [6/9] backup-monitoring.sh → volumes prometheus/grafana/alertmanager → /backup/monitoring
|
||
├── [7/9] backup-signoz.sh → volumes signoz-clickhouse/sqlite → /backup/signoz
|
||
├── [8/9] backup-open-webui.sh → SSH 188 volume open-webui → /backup/open-webui
|
||
└── [9/9] backup-clawbot.sh → SSH 188 volume clawbot-redis → /backup/clawbot
|
||
|
||
備份失敗 → notify_clawbot("failed") → /webhook/custom → Telegram 🔴
|
||
|
||
192.168.0.188 (Velero) 每日 02:00
|
||
└── K8s 資源快照 → MinIO :9000 (bucket: velero)
|
||
```
|
||
|
||
---
|
||
|
||
## 尚未備份(說明)
|
||
|
||
| 服務 | 原因 | 備記 |
|
||
|------|------|------|
|
||
| Prometheus TSDB | 原始指標數據(非設定),TSDB 自帶 30d TTL | 低優先;Grafana 設定已備份 |
|
||
| Sentry | 目前沒有在運行(docker ps 空)| 有 volume,重新部署後再評估 |
|
||
| Redis (AWOOOI) | Cache/WorkingMemory,無持久業務數據 | 低優先 |
|
||
| Velero MinIO 數據 | MinIO 是備份的備份,需離機備份 | 待評估 B2/S3 offsite |
|
||
|
||
---
|
||
|
||
## 驗證 SOP
|
||
|
||
```bash
|
||
# 最新備份日誌
|
||
ssh wooo@192.168.0.110 "tail -50 /backup/logs/backup.log"
|
||
|
||
# 所有服務快照數
|
||
ssh wooo@192.168.0.110 "for r in gitea momo harbor awoooi langfuse monitoring signoz open-webui clawbot; do
|
||
echo -n \"\$r: \"
|
||
restic -r /backup/\$r snapshots --password-file /backup/scripts/.restic-password 2>/dev/null | grep -c snapshot || echo 0
|
||
done"
|
||
|
||
# 告警測試
|
||
ssh wooo@192.168.0.110 "source /backup/scripts/common.sh && notify_clawbot 'warning' 'manual-test' '手動告警測試' 0"
|
||
```
|
||
|
||
---
|
||
|
||
## 相關文件
|
||
|
||
- [REBOOT-RECOVERY-SOP.md](REBOOT-RECOVERY-SOP.md) - 重開機恢復 SOP
|
||
- `scripts/backup/` - 所有備份腳本(Git 版本)
|
||
- `/backup/scripts/` (on 110) - 實際部署腳本
|