Files
knowledge-base/AI/mem0/03-deployment.md
hermes-bot 9fd51e7556 refactor: 重构目录结构
- 顶级目录改为 AI/
- 次级目录为具体技术(如 mem0)
- 仓库定位为综合知识库
2026-05-29 16:05:57 +00:00

120 lines
3.3 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.
# Mem0 部署方案
## 部署选项
### 选项 Aserver/(完整功能)
| 组件 | 说明 |
|------|------|
| **Mem0 Server** | FastAPI 服务 |
| **PostgreSQL + pgvector** | 关系数据 + 向量存储 |
| **Neo4j** | 图数据库(可选) |
### 选项 Bopenmemory/(轻量,已 sunset
仅需 Qdrant但官方已停止维护不建议使用。
---
## K8s 部署server/ 方案)
### 你已有的基础设施
```
tei namespace 下已有:
├── Qdrant ← 向量数据库
├── PostgreSQL ← 关系数据库
├── Dify ← 编排平台LLM 能力?)
├── TEI ← Text Embeddings Inference
└── BGM ← BGE-M3 嵌入模型服务
```
### 部署架构
```
┌─────────────────────────────────────────────────────────────┐
│ Mem0 Pod │
│ ├── mem0-server (main container) │
│ │ - Port: 8000 │
│ │ - 连接 TEI、Qdrant、PostgreSQL、LLM │
│ └── git-sync (sidecar, 可选) │
│ - 从 Gitea 拉取配置/知识库 │
└─────────────────────────────────────────────────────────────┘
├─ TEI: http://tei-server:8080
├─ Qdrant: http://qdrant:6333
├─ PostgreSQL: postgres:5432
└─ LLM: 待确认Dify / OpenAI 代理 / Ollama
```
### 核心环境变量
```bash
# PostgreSQL已有
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=mem0
POSTGRES_USER=postgres
POSTGRES_PASSWORD=xxx
APP_DB_NAME=mem0_app
# Qdrant已有
QDRANT_HOST=qdrant
QDRANT_PORT=6333
# TEI Embedder已有
EMBEDDER_PROVIDER=tei
TEI_ENDPOINT=http://tei-server:8080
# LLM待确认
LLM_PROVIDER=openai # 或 dify / ollama / anthropic
OPENAI_API_KEY=xxx # 或通过 Dify
# Auth
JWT_SECRET=xxx
ADMIN_API_KEY=xxx
AUTH_DISABLED=false
# Telemetry国内建议关闭
MEM0_TELEMETRY=false
```
### 你需要准备的内容
1. [ ] 确认 LLM 来源Dify / OpenAI 代理 / Ollama
2. [ ] 确认 PostgreSQL 数据库已创建(`mem0` 数据库)
3. [ ] 确认 Qdrant collection 已创建(或让 mem0 自动创建)
4. [ ] 配置环境变量
5. [ ] 编译/获取 mem0 镜像
---
## 国内网络问题
### 问题
- 无法访问 Docker Hub
- 无法访问 GitHub raw content
### 解决方式
1. **镜像提前导入**:在有网环境 `docker pull``docker save`,导入到 K8s 节点
2. **内网镜像仓库**:配置私有的 Harbor 或 registry
3. **代码构建**:下载代码后 `docker build` 本地镜像
### 建议的镜像来源
| 镜像 | 国内可用的 registry |
|------|-------------------|
| pgvector | `registry.cn-hangzhou.aliyuncs.com` 搜索 |
| neo4j | `docker.m.daocloud.io/neo4j` (DaoCloud) |
| mem0 | 需自行 build 或找社区镜像 |
---
## 待完成
- [ ] 确认 mem0 代码可下载
- [ ] 确认 LLM 来源
- [ ] 生成 K8s YAML 文件
- [ ] 测试部署