Clustering & Storage
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
A single Qdrant instance can be grown into a multi-node cluster, at which point a collection’s points are sharded and replicated across nodes and a Raft group keeps every node’s view of the cluster consistent. This page covers that distributed deployment model, the on-disk/in-memory storage trade-off available whether or not a cluster is in play, and snapshots for backup and node bootstrapping.
Distributed deployment
Qdrant runs as a single binary either standalone or as one peer in a cluster: each node runs the same
Qdrant process, is started with --uri pointing at itself and, for every node after the first,
--bootstrap pointing at an existing cluster member so it can join. Once joined, a peer participates in
Raft consensus (below) and can host shards for any collection, regardless of which node the client happens
to talk to — Qdrant forwards a request internally to whichever peer holds the relevant shard.
The full node lifecycle — starting a cluster, adding and removing peers, and the command-line flags involved — is described in Distributed Deployment.
Running a three-node cluster
Cluster mode is off by default and is switched on with QDRANT__CLUSTER__ENABLED=true (or cluster.enabled: true in
config.yaml). The commands below start three nodes on one Docker network; they are what produced every cluster
output on this page. Each node gets a unique --uri that the other nodes can reach on the internal port 6335, and
every node after the first bootstraps from an existing one:
docker network create qdrant-net
docker run -d --name qdrant-n1 --network qdrant-net -p 6333:6333 \
-e QDRANT__CLUSTER__ENABLED=true \
qdrant/qdrant:latest ./qdrant --uri http://qdrant-n1:6335
docker run -d --name qdrant-n2 --network qdrant-net -p 6433:6333 \
-e QDRANT__CLUSTER__ENABLED=true \
qdrant/qdrant:latest ./qdrant --bootstrap http://qdrant-n1:6335 --uri http://qdrant-n2:6335
docker run -d --name qdrant-n3 --network qdrant-net -p 6533:6333 \
-e QDRANT__CLUSTER__ENABLED=true \
qdrant/qdrant:latest ./qdrant --bootstrap http://qdrant-n1:6335 --uri http://qdrant-n3:6335
Start the first node, wait for it to listen, then start the others. After a few seconds GET /cluster on any node
lists all three peers and shows which one is the Raft leader (abridged; peer ids are random 64-bit numbers):
{
"result": {
"status": "enabled",
"peer_id": 4839932031055219,
"peers": {
"4950477918720395": { "uri": "http://qdrant-n2:6335/" },
"4839932031055219": { "uri": "http://qdrant-n1:6335/" },
"1490501925750853": { "uri": "http://qdrant-n3:6335/" }
},
"raft_info": { "term": 1, "commit": 9, "pending_operations": 0,
"leader": 4839932031055219, "role": "Leader", "is_voter": true },
"consensus_thread_status": { "consensus_thread_status": "working" },
"message_send_failures": {}
}
}
On a standalone node the same endpoint answers {"status":"disabled"}. In production, put the nodes behind a load
balancer or give the client the whole list of nodes, expose 6335 only to the other peers, and enable TLS for the
internal port as well (the cluster.p2p.enable_tls setting) so peer traffic is not plaintext.
Sharding
A collection’s points are split into a fixed number of shards, set at collection-creation time via
shard_number and never changed afterwards (growing shard count later means creating a new collection and
migrating data, or using resharding where supported). Qdrant distributes those shards across the cluster’s
peers, so a collection with more shards than the cluster has nodes spreads storage and query load more
evenly, while a shard_number of 1 keeps a collection entirely on one node’s worth of data (still
replicable, just not partitioned).
// PUT /collections/documents
{
"vectors": {
"size": 768,
"distance": "Cosine"
},
"shard_number": 6,
"replication_factor": 2
}
Creating a collection with three shards and a replication factor of two on that cluster took about ten seconds (the
shards must be created on several peers) and GET /collections/documents/cluster then showed the placement. Each of
the six replicas lives on a different peer than its twin:
shard 0: replicas on peer n1 and peer n2
shard 1: replicas on peer n1 and peer n3
shard 2: replicas on peer n2 and peer n3 (all Active; 3 shards x 2 replicas over 3 peers)
A request can be sent to any peer: the same nearest-neighbor query returned the same two points whether it was sent to n1 or to n2, because the receiving peer fans the query out to a replica of every shard and merges the answers.
By default, points are assigned to shards by hashing their id, spreading them evenly; a collection can
instead define a custom sharding key so that points sharing a key (e.g. a tenant id) always land on the
same shard, which is useful for scoping a query to one tenant’s data. Custom sharding is chosen at creation (sharding_method=ShardingMethod.CUSTOM) and shard keys are created
explicitly. In the verified example below two tenants get their own shard key; a write names its key with
shard_key_selector, and a query naming the key sees only that tenant’s data:
client.create_collection("tenants",
vectors_config=models.VectorParams(size=2, distance=models.Distance.DOT),
sharding_method=models.ShardingMethod.CUSTOM, shard_number=1)
client.create_shard_key("tenants", "acme")
client.create_shard_key("tenants", "globex")
client.upsert("tenants", wait=True, shard_key_selector="acme",
points=[models.PointStruct(id=1, vector=[1, 0]), models.PointStruct(id=2, vector=[0, 1])])
client.upsert("tenants", wait=True, shard_key_selector="globex",
points=[models.PointStruct(id=3, vector=[1, 1])])
client.query_points("tenants", query=[1, 1], shard_key_selector="acme") # ids 2, 1
client.query_points("tenants", query=[1, 1]) # ids 3, 2, 1: all shards
Routing a query to one shard key skips every other tenant’s data entirely, which is both a performance and an
isolation benefit. See Distributed Deployment for the
sharding methods and the resharding operations that change shard_number of an existing collection.
Replication
replication_factor (shown above alongside shard_number) sets how many copies of each shard Qdrant
keeps, placed on different peers whenever the cluster has enough nodes to do so. A read can be served by
any in-sync replica and a write must reach a quorum of a shard’s replicas (governed by write_consistency_factor) before it is acknowledged, so the collection keeps serving both reads and writes through the loss
of a minority of a shard’s replicas. A replica that falls behind or drops out is marked Dead and later
brought back in sync automatically, or can be recovered from a snapshot (below) rather than a full resync.
from qdrant_client import QdrantClient
from qdrant_client.http import models
client = QdrantClient(url="http://localhost:6333")
client.create_collection(
collection_name="documents",
vectors_config=models.VectorParams(size=768, distance=models.Distance.COSINE),
shard_number=6,
replication_factor=2,
write_consistency_factor=1,
)
# inspect current shard/replica placement across the cluster
info = client.collection_cluster_info(collection_name="documents")
print(info)
Surviving a node failure
The experiment: with the three-node cluster above and the documents collection holding four points, stop the third
node (docker stop qdrant-n3) and keep working through the first. A nearest-neighbor query still returned the same
two points as before, and an upsert with write_consistency_factor=1 succeeded with "status":"completed", because
every shard still had a live replica. After docker start qdrant-n3 the node rejoined the Raft group, and a
points/count sent to that node reported all five points, including the one written while it was down:
docker stop qdrant-n3
curl -X POST http://localhost:6333/collections/documents/points/query \
-H 'Content-Type: application/json' -d '{"query":[0.9,0.1,0.2,0.1],"limit":2}' # still answers
docker start qdrant-n3
curl -X POST http://localhost:6533/collections/documents/points/count \
-H 'Content-Type: application/json' -d '{"exact":true}' # {"count":5}
write_consistency_factor is the dial between availability and durability: it is the number of replicas that must
acknowledge a write before it is reported as done. A factor of 1, as used here, keeps writes flowing while a replica
is down at the price of a window in which only one copy holds the new data; a higher factor strengthens durability and
makes writes depend on more replicas being reachable. It is set per collection. Raft itself needs a majority of peers
to commit metadata changes such as creating a collection, so a three-node cluster tolerates one failed peer for those
operations.
Raft-based consensus
Every peer runs the Raft consensus algorithm, but Raft in Qdrant governs cluster metadata — collection configurations, which shard replicas live on which peer, and cluster peer membership itself — not the point data inside a collection. One peer is elected Raft leader for that metadata log; a change such as creating a collection or moving a shard replica is proposed through Raft and only takes effect once a majority of peers have committed it, which is what keeps every node’s view of the cluster’s topology consistent even as peers join, leave, or fail. The actual vectors and payloads inside a shard are kept in sync by the shard replication mechanism described above, entirely separate from the Raft log — a design that mirrors the general pattern (also seen in Neo4j’s own Raft-based clustering) of using Raft for metadata/topology consensus while replicating the bulk data through a different path.
# cluster-wide status: peers, this node's Raft role, and pending Raft operations
curl http://localhost:6333/cluster
See Distributed Deployment for how peers
join and leave the Raft group and how consensus operations are exposed through the /cluster API.
On-disk vs. in-memory storage
Independent of clustering, each collection chooses where its vectors and payload live. By default vectors
are kept fully in RAM for the lowest query latency; setting on_disk: true on the vector configuration
instead memory-maps the vector data from disk, letting a collection far larger than available RAM be
served at the cost of some latency (mmap pages are faulted in on access, and cold data is slower than a
warm in-memory read). Payload storage has an analogous choice: an on-disk payload store trades a small
latency cost for keeping structured payload out of RAM entirely.
// PUT /collections/documents
{
"vectors": {
"size": 768,
"distance": "Cosine",
"on_disk": true
},
"hnsw_config": {
"on_disk": true
}
}
The collection info read back from a collection created with exactly this configuration shows
"on_disk": true under both the vector parameters and the HNSW config, and on_disk_payload: true. That last flag is
already the default in current releases, so payload is on disk unless you opt out with on_disk_payload: false. Three
related switches are worth knowing: quantization_config with always_ram=true keeps a compact copy of vectors in
memory for fast candidate search while the originals stay on disk (see
Vector Indexing & HNSW); datatype=Datatype.FLOAT16 halves vector
memory; and a payload index can itself be created on_disk for large keyword fields.
RAM or on_disk"] H --> C["Candidate ids"] C --> QV["Quantized vectors
always_ram: RAM"] QV --> R["Rescore with original vectors
RAM or mmap from disk"] R --> P["Fetch payload
on_disk_payload: from disk"] P --> OUT["Response"]
Memory-mapped data is served from the operating system’s page cache, so an on-disk collection is fast when its working set fits in free RAM and slow, with random disk reads, when it does not. Fast local NVMe storage is the practical requirement; network file systems are discouraged by the Qdrant documentation because of their latency and locking behavior.
Because this is a per-collection (and per named vector) setting rather than a cluster-wide one, a deployment can keep a small, latency-sensitive collection fully in memory while a much larger archival collection runs mostly from disk on the same cluster.
Snapshots
A snapshot is a point-in-time copy of a collection (or, taken across every collection, of the whole
node/cluster) that Qdrant can create on demand and later restore from. Snapshots serve two purposes:
backup/restore, and bootstrapping a new replica for a shard without a full resync — Qdrant can recover a
Dead replica directly from a peer’s snapshot instead of re-streaming every point.
# create a snapshot of one collection
curl -X POST http://localhost:6333/collections/documents/snapshots
# list existing snapshots for that collection
curl http://localhost:6333/collections/documents/snapshots
# download a snapshot by name (from the list above) to a local file
curl -o documents.snapshot \
http://localhost:6333/collections/documents/snapshots/documents-1520182214685560-2026-09-15-10-00-00-0.snapshot
client.create_snapshot(collection_name="documents")
snapshots = client.list_snapshots(collection_name="documents")
for snapshot in snapshots:
print(snapshot.name, snapshot.creation_time, snapshot.size)
Snapshot names embed the id of the peer that created them, a timestamp and a counter, so do not construct one by hand: list and use what the server returns. On the five-point example the create call answered (abridged):
{"result":{"name":"catalog-1520182214685560-2026-11-10-13-53-07-0.snapshot",
"creation_time":"2026-11-10T13:53:07","size":130560,"checksum":"1b31ceba..."}}
A snapshot of a three-point named-vector collection weighed 130,560 bytes, and a full snapshot of an instance holding
about 94 MB of test collections (POST /snapshots, one file for all collections) took 57 seconds while the server was
busy with other work, so schedule full snapshots outside peak write load. Snapshots live in /qdrant/snapshots inside the container, which
should be on a mounted volume if they are to survive the container.
The round trip was verified end to end: after downloading the snapshot, the collection was deleted
(DELETE /collections/catalog), then restored by uploading the file, and points/count returned the original 3.
The priority parameter decides which side wins when the collection already exists: snapshot makes the uploaded
data authoritative, replica keeps the existing data.
curl -X POST 'http://localhost:6333/collections/catalog/snapshots/upload?priority=snapshot' \
-H 'Content-Type: multipart/form-data' -F 'snapshot=@catalog.snapshot'
Restoring uploads a snapshot file to a (typically empty) collection, or a node can be started with a
--snapshot recovery flag pointing at one; the full set of snapshot, recovery, and shard-snapshot
endpoints is documented in Snapshots.
Where to go next
-
CRUD & Batch Operations — the point-level writes whose durability and availability this page’s sharding, replication, and snapshots protect.
-
Security & Administration — securing and administering the cluster described here (API keys, TLS, RBAC, and cluster-level administration).