python unified_api.py
curl "http://localhost:8084/api/v0/data_pipeline/vector/restore/list"
curl -X POST http://localhost:8084/api/v0/data_pipeline/vector/restore \
-H "Content-Type: application/json" \
-d '{
"backup_path": "./data_pipeline/training_data/task_20250721_213627/vector_bak",
"timestamp": "20250721_215758",
"truncate_before_restore": true
}'
API | 方法 | 端点 | 功能 |
---|---|---|---|
列表API | GET | /api/v0/data_pipeline/vector/restore/list |
查看所有备份文件 |
恢复API | POST | /api/v0/data_pipeline/vector/restore |
恢复备份数据 |
global_only=true
- 仅查看全局备份task_id=xxx
- 查看指定任务备份backup_path
- 备份目录路径timestamp
- 时间戳(YYYYMMDD_HHMMSS)truncate_before_restore: true
- 清空后恢复(推荐)tables: ["langchain_pg_embedding"]
- 仅恢复指定表db_connection: "postgresql://..."
- 自定义数据库连接curl "http://localhost:8084/api/v0/data_pipeline/vector/restore/list?task_id=task_20250721_213627"
curl "http://localhost:8084/api/v0/data_pipeline/vector/restore/list?global_only=true"
curl -X POST http://localhost:8084/api/v0/data_pipeline/vector/restore \
-H "Content-Type: application/json" \
-d '{
"backup_path": "./data_pipeline/training_data/vector_bak",
"timestamp": "20250722_010318",
"tables": ["langchain_pg_embedding"],
"truncate_before_restore": false
}'
curl -X POST http://localhost:8084/api/v0/data_pipeline/vector/restore \
-H "Content-Type: application/json" \
-d '{
"backup_path": "./data_pipeline/training_data/vector_bak",
"timestamp": "20250722_010318",
"db_connection": "postgresql://user:password@localhost:5432/target_db",
"truncate_before_restore": true
}'
truncate_before_restore: true
./data_pipeline/...
)YYYYMMDD_HHMMSS
格式# 错误:缺少必填参数
{"code": 400, "message": "缺少必需参数: backup_path, timestamp"}
# 错误:备份文件不存在
{"code": 404, "message": "备份目录不存在"}
# 已修复:cmetadata列JSON格式自动转换
# 无需手动处理Python字典格式问题
truncate_before_restore: true
恢复tables
参数指定表truncate_before_restore: false
💡 提示: 详细文档请参考 vector_restore_api_user_guide.md