引子:数据库应用,备份还原很重要,Qdrant提供了快照功能,用于存档数据或复制现有部署,另外,Qdrant Cloud上还提供了 Backups 管理备份。
参考官网:Snapshots - Qdrant
API:List all snapshots (collection) — Qdrant | API Reference
这里简单整理下关于快照的使用,本地环境
1 准备:本地docker快启一个Qdrant实例, 打开localhost:6333/dashboard,创建个test集合,写点测试数据
docker pull qdrant/qdrant:v1.9.7
docker run -d \
-v /home/pet/qdrant/storage:/qdrant/storage \
-v /home/pet/qdrant/snapshots:/qdrant/snapshots \
--name pet-qdrant \
--restart=always \
--network host \
--memory="2048m" \
--cpus="1" \
qdrant/qdrant:v1.9.7
docker logs -f pet-qdrant
2 创建快照
# 1 调用 REST API 创建快照
curl -X POST http://localhost:6333/collections/collection_name/snapshots
# 2 使用 python 驱动创建
from qdrant_client import QdrantClient
client = QdrantClient(url="http://localhost:6333")
client.create_snapshot(collection_name="{collection_name}")
# ... 其他驱动参考官网
快照文件所在目录:
创建成功后会在挂载的 “/home/pet/qdrant/snapsho