Qdrant can take a snapshot of one collection on one node. These snapshots are stored on that node’s disk, separate from the snapshots in the Snapshot tab. Use them when you need to download a collection.
Before you begin
Section titled “Before you begin”You need a Running database, its Endpoint URL, and its API Key; see
Connect to a vector database. Each call
goes to one node and one collection, so repeat it for every node. Nodes are numbered from 0 to the
node count minus 1. Add node-<node> to the address, where <node> is the node’s number. <your-endpoint-url> is the Endpoint
URL, <your-api-key> is your API key, and <collection_name> is the collection.
Create a snapshot
Section titled “Create a snapshot”from qdrant_client import QdrantClient
client = QdrantClient( host="<your-endpoint-url>", port=6333, prefix="node-<node>", api_key="<your-api-key>")client.create_snapshot(collection_name="<collection_name>")With cURL:
curl -X POST \ -H "api-key: <your-api-key>" \ https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshotsList snapshots
Section titled “List snapshots”client.list_snapshots(collection_name="<collection_name>")curl -X GET \ -H "api-key: <your-api-key>" \ https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshotsDownload a snapshot file
Section titled “Download a snapshot file”<snapshot_name> is a name from the list.
curl -X GET \ -H "api-key: <your-api-key>" \ https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshots/<snapshot_name>Restore a snapshot
Section titled “Restore a snapshot”<file_location> is where the snapshot file is.
client.recover_snapshot( "<collection_name>", "<file_location>")curl -X PUT \ -H "api-key: <your-api-key>" \ -d '{ "location": "<file_location>" }' \ https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshots/recoverTo restore from a file on your computer, upload it. <file_name> is the snapshot file.
curl -X POST \ 'https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshots/upload?priority=snapshot' \ -H 'api-key: <your-api-key>' \ -H 'Content-Type: multipart/form-data' \ -F 'snapshot=@/path/to/<file_name>.snapshot'A restore takes a priority that decides which data wins when both exist. Pass one of these as the
priority value of the upload address:
replica (default) Keeps existing data over snapshot data.snapshot Keeps snapshot data over existing data.no_sync Restores without any extra synchronization.Delete a snapshot
Section titled “Delete a snapshot”client.delete_snapshot( collection_name="<collection_name>", snapshot_name="<snapshot_name>")curl -X DELETE \ -H "api-key: <your-api-key>" \ https://<your-endpoint-url>:6333/node-<node>/collections/<collection_name>/snapshots/<snapshot_name>What to do next
Section titled “What to do next”For a backup of the whole database in one step, take a snapshot in the portal. For help, see Troubleshooting Vector Database.