Skip to content
Vector database engineering on Kubernetes · Chapter 6 of 20 Day 5: Distributed Qdrant – branches, shelves, second copies

Day 5: Distributed Qdrant – branches, shelves, second copies

Goal: take Qdrant from one to three pods, understand shards and replicas, prove replication instead of deriving it from the number of pods, measure writing and reading with one node missing · Duration: about 120 min · Prerequisite: Day 0 to Day 4

State before this chapter

Qdrant runs as a single pod on vdb2, the collection doku has 13,220 points, an HNSW index and a payload index on bereich.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (excerpt – one pod, Running):

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          16h   10.42.1.19   vdb2   <none>           <none>
# on vdb1
kubectl get nodes -L vdb-rolle

Expected:

NAME   STATUS   ROLES           AGE   VERSION        VDB-ROLLE
vdb1   Ready    control-plane   18h   v1.37.3+k3s1   
vdb2   Ready    <none>          18h   v1.37.3+k3s1   daten
vdb3   Ready    <none>          18h   v1.37.3+k3s1   daten
vdb4   Ready    <none>          18h   v1.37.3+k3s1   daten

Three nodes carry the label vdb-rolle=daten. Today each of them gets a Qdrant pod.

Introduction

A single Qdrant pod is a single point of failure. If it restarts, search is gone. The obvious answer in Kubernetes is: replicaCount: 3. Three pods, so three times as safe?

No. With Qdrant, three pods mean three peers in a cluster – but a collection only lives where its shards live. How many copies of each shard exist is decided by the collection’s replication factor, not by the number of pods. And a collection created before scaling up stays where it was.

That is what you measure today: first a failure with three pods and one copy, then with two copies. After that you distribute a collection across all three nodes, write while one node is missing, and watch Qdrant deliver the missed writes afterwards.

Today you will learn:

  • to bring Qdrant to three pods with Helm, one per node,
  • to query the peers, the Raft leader and the shards of a collection,
  • to prove that more pods are not replication,
  • to explicitly copy a shard to a second peer,
  • to create a collection with shards and replicas and read its distribution,
  • to measure what writing and reading do with one peer missing – and what consistency changes.

Background

The picture of the day: the library gets branches

Until now the city library had one building. Now it opens two branches – three buildings, one each on vdb2, vdb3 and vdb4. A new building, however, starts out empty. The books are still in the old building.

  • A shard is a shelf with part of the holdings. A collection with three shards stands on three shelves.
  • A replica is a second copy of an entire shelf in another building.
  • The library council (Raft) keeps the list of which shelf stands in which building. It has a chair (leader); changes to the list only take effect once the majority agrees.
  • If someone in a branch asks for a book that is not there, the branch calls the building that has it – the visitor notices nothing, as long as that building can be reached.

A new building does not make the holdings any safer. Only second copies in another building do.

The terms

Term Meaning In the picture
Peer a Qdrant process in the cluster, here a pod a building
Raft, leader consensus protocol for the cluster metadata; one peer leads the library council and its chair
Shard part of a collection; shard_number sets the count a shelf
Replica copy of a shard on another peer second copy of the shelf
replication_factor desired copies per shard for newly created shards how many copies are planned
Shard transfer copying a shard between peers (snapshot, wal_delta …) moving or restocking a shelf
State Active, Partial, Dead replica ready, being built, missing writes shelf open, being stocked, closed
consistency how many replicas must answer a read request how many buildings you ask

Remember: pods are buildings, shards are shelves, replicas are second copies. Only what stands as a second copy in another building survives a failure.

Drill 1: Three pods, one per node

Where you are: on vdb1.

What you have afterwards: three Qdrant pods on vdb2, vdb3 and vdb4 that form a cluster.

Step 1 – write the values for three pods. You take the values from Day 2 and change two things: the number of pods and a rule that two Qdrant pods never run on the same node.

# on vdb1
mkdir -p ~/labor/tag05
# on vdb1
cd ~/labor/tag05
# on vdb1
nano qdrant-werte.yaml
~/labor/tag05/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
    memory: 2Gi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true
Setting Value Meaning
replicaCount 3 three pods in the StatefulSet: qdrant-0, qdrant-1, qdrant-2
podAntiAffinity … rule for which pods do not get along side by side
requiredDuringScheduling… hard rule: rather no pod than two on one node
matchLabels app.kubernetes.io/name: qdrant applies to all Qdrant pods
topologyKey kubernetes.io/hostname “side by side” means: on the same node

Without the rule, the scheduler could put two pods on the same node – and then two second copies would also be in the same building. You do not need to switch on cluster mode: the chart already starts Qdrant in cluster mode, even with just one pod.

Step 2 – roll out.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
NAME: qdrant
LAST DEPLOYED: Sat Dec  5 09:52:02 2026
NAMESPACE: qdrant
STATUS: deployed
REVISION: 5
# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s
  • rollout status waits until all pods of the StatefulSet are new and ready.
  • --timeout=300s aborts with an error after five minutes instead of waiting forever.

Expected:

Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for partitioned roll out to finish: 2 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 3 new pods have been updated...

What you see: first qdrant-1 and qdrant-2 are added, then qdrant-0 is restarted with the new rule. For me this took a little over two minutes.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (truncated on the right; your IPs will differ):

NAME       READY   STATUS    RESTARTS   AGE     IP           NODE
qdrant-0   1/1     Running   0          22s     10.42.1.20   vdb2
qdrant-1   1/1     Running   0          2m21s   10.42.3.12   vdb4
qdrant-2   1/1     Running   0          2m21s   10.42.2.11   vdb3

One pod per node. Note down the three IPs – you will use them shortly to ask each peer individually. After every restart of a pod its IP changes; read it again then.

Step 3 – look at the cluster. Insert the IP of qdrant-0.

# on vdb1
curl -s http://10.42.1.20:6333/cluster -o cluster.json
# on vdb1
jq '.result | {peer_id, peers, raft_info}' cluster.json

Expected (your peer IDs will differ):

{
  "peer_id": 121400021250061,
  "peers": {
    "1485700002748332": {
      "uri": "http://qdrant-2.qdrant-headless:6335/"
    },
    "121400021250061": {
      "uri": "http://qdrant-0.qdrant-headless:6335/"
    },
    "857928665674298": {
      "uri": "http://qdrant-1.qdrant-headless:6335/"
    }
  },
  "raft_info": {
    "term": 4,
    "commit": 26,
    "pending_operations": 0,
    "leader": 1485700002748332,
    "role": "Follower",
    "is_voter": true
  }
}
Field Value Meaning
peer_id 121400021250061 ID of this peer (qdrant-0)
peers three entries all members; they talk to each other over port 6335
term 4 the council’s term of office; increases with every new leader election
commit 26 number of agreed changes to the metadata
leader 1485700002748332 the chair – here qdrant-2
role Follower qdrant-0 follows; when it restarted, a new election was held

What you see: three buildings, one council. Before scaling up, qdrant-0 was leader in term 3; its restart triggered an election.

Remember: replicaCount makes buildings. Whether they form a cluster is shown by /cluster – three peers, one leader.

Save your progress? Sign up for free

Drill 2: More pods are not replication

Where you are: on vdb1.

What you have afterwards: proof that doku has only one copy despite three pods – and what that means in a failure.

Step 1 – where is doku? Every peer can tell you which shards of a collection it holds and which are elsewhere. First qdrant-0:

# on vdb1
curl -s http://10.42.1.20:6333/collections/doku/cluster -o d0.json
# on vdb1
jq -c .result d0.json

Expected:

{"peer_id":121400021250061,"shard_count":1,"local_shards":[{"shard_id":0,"points_count":13220,"state":"Active"}],"remote_shards":[],"shard_transfers":[]}

Then qdrant-1:

# on vdb1
curl -s http://10.42.3.12:6333/collections/doku/cluster -o d1.json
# on vdb1
jq -c .result d1.json

Expected:

{"peer_id":857928665674298,"shard_count":1,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]}

What you see: doku has one shard, and it lives only on qdrant-0 (local_shards). qdrant-1 knows the collection but has no shelf of its own – only a reference (remote_shards).

Step 2 – query through another peer.

# on vdb1
curl -s -X POST http://10.42.3.12:6333/collections/doku/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected:

{"result":{"count":13220},"status":"ok","time":0.031149499}

qdrant-1 answers correctly – it called qdrant-0.

Step 3 – restart the pod with the data. Note the time, delete qdrant-0 and immediately query again through qdrant-1. The StatefulSet restarts the pod with the same volume.

# on vdb1
date +%T
# on vdb1
kubectl -n qdrant delete pod qdrant-0 --wait=false
  • delete pod terminates the pod; the StatefulSet controller recreates it right away.
  • --wait=false returns immediately instead of waiting for the pod to finish.

Expected:

09:54:44
pod "qdrant-0" deleted from qdrant namespace

Now repeat the count from Step 2 every two seconds, each time with date +%T in front.

Expected (excerpt, error messages truncated on the right):

09:54:46 {"result":{"count":13220},"status":"ok","time":0.008336605}
09:54:52 {"status":{"error":"Service internal error: 1 of 1 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavai
09:55:07 {"status":{"error":"Service internal error: 1 of 1 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavai
09:55:10 {"result":{"count":13220},"status":"ok","time":0.018611532}

What you see: for about 20 seconds doku cannot be read, although two other pods are running. “1 of 1 read operations failed”: there is exactly one copy, and its building is closed.

Step 4 – increase the replication factor. The obvious attempt: tell the collection it should have two copies. First read the current value.

# on vdb1
curl -s http://10.43.151.237:6333/collections/doku -o doku.json
# on vdb1
jq -c '.result.config.params' doku.json

Expected:

{"vectors":{"size":768,"distance":"Cosine"},"shard_number":1,"replication_factor":1,"write_consistency_factor":1,"on_disk_payload":true}
# on vdb1
curl -s -X PATCH http://10.43.151.237:6333/collections/doku -H 'Content-Type: application/json' -d '{"params": {"replication_factor": 2}}'

Expected:

{"result":true,"status":"ok","time":0.134513515}

Repeat the two read commands from before.

Expected:

{"vectors":{"size":768,"distance":"Cosine"},"shard_number":1,"replication_factor":2,"write_consistency_factor":1,"on_disk_payload":true}

And now the test on qdrant-1 – the two commands from Step 1 once more:

Expected:

{"peer_id":857928665674298,"shard_count":1,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]}

What you see: the configuration says 2, but the cluster still has one copy. The replication_factor applies to shards that are newly created. Qdrant does not copy an existing shard on its own.

Remember: three pods with one copy are three buildings with one copy. Whether second copies exist is shown only by /collections/<name>/cluster – not by the pod list, not by the configuration.

Save your progress? Sign up for free

Drill 3: Creating the second copy

Where you are: on vdb1.

What you have afterwards: doku with two copies on two nodes – and a failure without errors.

Step 1 – copy the shard. You tell Qdrant: copy shard 0 from qdrant-0 to qdrant-1. The peer IDs are in cluster.json from Drill 1.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/doku/cluster -H 'Content-Type: application/json' -d '{"replicate_shard": {"shard_id": 0, "from_peer_id": 121400021250061, "to_peer_id": 857928665674298}}'
Setting Value Meaning
replicate_shard copy a shard; the original stays
shard_id 0 the only shard of doku
from_peer_id 121400021250061 qdrant-0, has the data
to_peer_id 857928665674298 qdrant-1, receives the copy

Expected:

{"result":true,"status":"ok","time":0.803171427}

Step 2 – watch. Ask qdrant-1 several times in a row, each time with date +%T in front.

# on vdb1
curl -s http://10.42.3.12:6333/collections/doku/cluster -o doku-cluster.json
# on vdb1
jq -c '.result | {local_shards, transfers: [.shard_transfers[] | {from, to, method, comment}]}' doku-cluster.json

Expected (excerpt from several repetitions):

09:56:15 {"local_shards":[{"shard_id":0,"points_count":0,"state":"Recovery"}],"transfers":[{"from":121400021250061,"to":857928665674298,"method":"snapshot","comment":"downloading (0.02s) | 0 B transferred, 0 B/s"}]}
09:56:17 {"local_shards":[{"shard_id":0,"points_count":0,"state":"Recovery"}],"transfers":[{"from":121400021250061,"to":857928665674298,"method":"snapshot","comment":"downloading (1.58s) | 26.49 MiB transferred, 16.73 MiB/s"}]}
09:56:19 {"local_shards":[{"shard_id":0,"points_count":0,"state":"Recovery"}],"transfers":[{"from":121400021250061,"to":857928665674298,"method":"snapshot","comment":"unpacking (1.11s)"}]}
09:56:20 {"local_shards":[{"shard_id":0,"points_count":13220,"state":"Partial"}],"transfers":[{"from":121400021250061,"to":857928665674298,"method":"snapshot","comment":null}]}
09:56:22 {"local_shards":[{"shard_id":0,"points_count":13220,"state":"Active"}],"transfers":[{"from":121400021250061,"to":857928665674298,"method":"snapshot","comment":null}]}
09:56:23 {"local_shards":[{"shard_id":0,"points_count":13220,"state":"Active"}],"transfers":[]}

What you see: Qdrant transfers the shard as a snapshot: download (26.49 MiB), unpack, then Partial (data present, catching up on writes) and finally Active. After about eight seconds the second copy is ready.

Step 3 – the test on a peer without a copy. qdrant-2 has no shelf of its own, but now knows about two copies.

# on vdb1
curl -s http://10.42.2.11:6333/collections/doku/cluster -o d2.json
# on vdb1
jq -c .result d2.json

Expected:

{"peer_id":1485700002748332,"shard_count":1,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":0,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]}

Step 4 – the same failure again. Delete qdrant-0 as in Drill 2 and this time query through qdrant-2 every two seconds.

# on vdb1
kubectl -n qdrant delete pod qdrant-0 --wait=false
# on vdb1
curl -s -X POST http://10.42.2.11:6333/collections/doku/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected (excerpt from 25 repetitions from 09:56:56 to 09:57:45):

09:56:56 {"result":{"count":13220},"status":"ok","time":0.013247191}
09:57:10 {"result":{"count":13220},"status":"ok","time":0.009116128}
09:57:24 {"result":{"count":13220},"status":"ok","time":0.006939324}
09:57:45 {"result":{"count":13220},"status":"ok","time":0.00853446}

What you see: not a single error in 50 seconds. While qdrant-0 restarts, the copy on qdrant-1 answers all requests.

Remember: a second copy is created by a shard transfer, not by a number in the configuration. Only then does the collection survive the failure of a building.

Save your progress? Sign up for free

Drill 4: Two copies, two answers

Where you are: on vdb1, in ~/labor/tag04.

What you have afterwards: the insight that replicas have the same data, but not the same indexes.

You measure doku with recall.py from Day 4 – once directly through each peer. After the restart in Drill 3, qdrant-0 has a new IP; read it with kubectl -n qdrant get pods -o wide.

# on vdb1
cd ~/labor/tag04
# on vdb1
~/werkbank/bin/python recall.py http://10.42.1.22:6333 doku

Expected:

recall@10 0.992 · Median 12.9 ms · p95 16.3 ms · 100 Fragen
# on vdb1
~/werkbank/bin/python recall.py http://10.42.3.12:6333 doku

Expected:

recall@10 0.975 · Median 10.6 ms · p95 15.8 ms · 100 Fragen
# on vdb1
~/werkbank/bin/python recall.py http://10.42.2.11:6333 doku

Expected (two runs):

recall@10 0.975 · Median 14.6 ms · p95 19.2 ms · 100 Fragen
recall@10 0.981 · Median 15.9 ms · p95 25.9 ms · 100 Fragen

What you see: the same 13,220 points, but two results: 0.992 through qdrant-0, 0.975 through qdrant-1. A peer with its own copy answers from it. qdrant-2 has none and asks sometimes one, sometimes the other – its recall changes.

Step 2 – why? Compare the two copies.

# on vdb1
curl -s http://10.42.1.22:6333/collections/doku -o k0.json
# on vdb1
jq -c '.result | {status, optimizer_status, indexed_vectors_count, segments_count}' k0.json

Expected:

{"status":"green","optimizer_status":"ok","indexed_vectors_count":13220,"segments_count":4}

The same with the IP of qdrant-1 (file k1.json):

Expected:

{"status":"green","optimizer_status":"ok","indexed_vectors_count":13220,"segments_count":2}

What you see: the original has 4 segments, the copy 2. After the transfer, the optimizer on qdrant-1 merged segments and rebuilt their HNSW graph. Same books, different signposts – and an HNSW graph comes out slightly different every time it is built.

Step 3 – and through the Service? The Service distributes connections across the three pods. The Python client probably uses the same connection during a run – then one pod answers per run. Two runs in a row:

# on vdb1
~/werkbank/bin/python recall.py http://10.43.151.237:6333 doku

Expected (two runs):

recall@10 0.992 · Median 12.5 ms · p95 20.8 ms · 100 Fragen
recall@10 0.975 · Median 10.3 ms · p95 13.8 ms · 100 Fragen

What you see: which copy answers is decided by the chance of the connection. Anyone comparing recall has to know this – otherwise they measure replicas instead of settings.

Remember: replicas have the same points, but each builds its own index. Small differences in recall between copies are normal; measure specifically per peer if you want to compare them.

Save your progress? Sign up for free

Drill 5: A distributed collection

Where you are: on vdb1.

What you have afterwards: the collection verteilt with three shards and two copies each, distributed across all three nodes.

Step 1 – create.

# on vdb1
curl -s -X PUT http://10.43.151.237:6333/collections/verteilt -H 'Content-Type: application/json' -d '{"vectors": {"size": 768, "distance": "Cosine"}, "shard_number": 3, "replication_factor": 2, "write_consistency_factor": 1, "optimizers_config": {"indexing_threshold": 1000}}'
Setting Value Meaning
vectors 768, Cosine like doku
shard_number 3 three shelves, each with part of the points
replication_factor 2 each shelf twice, on different peers
write_consistency_factor 1 a write counts as soon as one replica has confirmed it
indexing_threshold 1000 build HNSW right away, as on Day 4

Expected:

{"result":true,"status":"ok","time":2.386020958}

You create the payload index from Day 4 right away – before loading:

# on vdb1
curl -s -X PUT http://10.43.151.237:6333/collections/verteilt/index -H 'Content-Type: application/json' -d '{"field_name": "bereich", "field_schema": "keyword"}'

Expected:

{"result":{"operation_id":2,"status":"acknowledged"},"status":"ok","time":0.345064649}

Step 2 – load.

# on vdb1
cd ~/labor/tag02
# on vdb1
~/werkbank/bin/python laden.py http://10.43.151.237:6333 verteilt

Expected:

13220 Punkte in 65.0 s geladen

For comparison: on Day 2 the same holdings loaded into a collection with one shard and one copy. Now Qdrant writes every point twice, on two nodes.

Step 3 – read the distribution. Ask each peer for its own shards. First qdrant-0:

# on vdb1
curl -s http://10.42.1.22:6333/collections/verteilt/cluster -o v0.json
# on vdb1
jq -c '.result | {peer_id, lokal: [.local_shards[] | {shard_id, points_count, state}]}' v0.json

Expected:

{"peer_id":121400021250061,"lokal":[{"shard_id":0,"points_count":4089,"state":"Active"},{"shard_id":2,"points_count":4429,"state":"Active"}]}

Repeat the two commands with the IPs of qdrant-1 and qdrant-2.

Expected:

{"peer_id":857928665674298,"lokal":[{"shard_id":1,"points_count":4702,"state":"Active"},{"shard_id":2,"points_count":4429,"state":"Active"}]}
{"peer_id":1485700002748332,"lokal":[{"shard_id":0,"points_count":4089,"state":"Active"},{"shard_id":1,"points_count":4702,"state":"Active"}]}
Shard Points Located on
0 4,089 qdrant-0, qdrant-2
1 4,702 qdrant-1, qdrant-2
2 4,429 qdrant-0, qdrant-1

What you see: six shelf copies, two per building, no shard twice in the same building. The three shards add up to 13,220 points. Qdrant distributes the points by their ID – that is why the shards are not exactly the same size.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/verteilt/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected:

{"result":{"count":13220},"status":"ok","time":0.012554063}

Each point is counted once, not once per copy.

Step 4 – measure.

# on vdb1
cd ~/labor/tag04
# on vdb1
~/werkbank/bin/python recall.py http://10.43.151.237:6333 verteilt

Expected (two runs):

recall@10 0.981 · Median 18.1 ms · p95 28.0 ms · 100 Fragen
recall@10 0.971 · Median 17.8 ms · p95 24.7 ms · 100 Fragen

What you see: about 18 ms instead of 10 to 12 ms for doku. Every search goes to all three shards, on at least two nodes, and the results are merged. Recall is slightly lower: three small graphs instead of one large one. With 13,220 points, distributing therefore costs time – it only pays off once a single node can no longer carry the holdings.

Remember: shard_number distributes the holdings across buildings, replication_factor secures each shelf in a second building. With small holdings, distributing costs latency; it is a capacity decision.

Save your progress? Sign up for free

Drill 6: Writing when a building is missing

Where you are: on vdb1, in ~/labor/tag05.

What you have afterwards: measurements of what writing and reading do with one peer missing – and how Qdrant closes the gap afterwards.

Step 1 – a small write program. It writes 30 test points one by one and counts successes and errors.

# on vdb1
cd ~/labor/tag05
# on vdb1
nano schreiben.py
~/labor/tag05/schreiben.py new file
"""Schreibt 30 Testpunkte in eine Collection und meldet, wie viele angenommen wurden."""
import sys
import time

import numpy as np
from qdrant_client import QdrantClient, models

QDRANT, COLLECTION, START = sys.argv[1], sys.argv[2], int(sys.argv[3])

vektoren = np.load("../tag01/vektoren.npy")
client = QdrantClient(url=QDRANT, timeout=10)

ok, fehler = 0, 0
for i in range(30):
    pid = START + i
    try:
        client.upsert(COLLECTION, points=[models.PointStruct(id=pid, vector=vektoren[i].tolist(),
                                                             payload={"bereich": "test"})], wait=True)
        ok += 1
    except Exception as e:
        fehler += 1
        letzter = str(e).splitlines()[0][:150]
print(f"{time.strftime('%T')} {ok} geschrieben, {fehler} Fehler" + (f" · zuletzt: {letzter}" if fehler else ""))
Line Meaning
START first ID; test points get IDs from 900000, far away from the holdings
upsert(…, wait=True) write and wait until Qdrant confirms the point
payload={"bereich": "test"} marker so you can find the test points again at the end

Step 2 – write with all three peers.

# on vdb1
~/werkbank/bin/python schreiben.py http://10.42.1.22:6333 verteilt 900000

Expected:

10:03:45 30 geschrieben, 0 Fehler

Step 3 – restart qdrant-1 and write immediately.

# on vdb1
kubectl -n qdrant delete pod qdrant-1 --wait=false
# on vdb1
~/werkbank/bin/python schreiben.py http://10.42.1.22:6333 verteilt 900100

Expected:

10:03:57 30 geschrieben, 0 Fehler

What you see: everything written, although one building is closed. With write_consistency_factor 1, confirmation from the replica that can be reached is enough.

Step 4 – what happens to the copies on qdrant-1.

# on vdb1
curl -s http://10.42.1.22:6333/collections/verteilt/cluster -o v0.json
# on vdb1
jq -c '.result | {lokal: [.local_shards[] | {shard_id, state}], entfernt: [.remote_shards[] | {shard_id, peer_id, state}]}' v0.json

Expected:

{"lokal":[{"shard_id":0,"state":"Active"},{"shard_id":2,"state":"Active"}],"entfernt":[{"shard_id":0,"peer_id":1485700002748332,"state":"Active"},{"shard_id":1,"peer_id":857928665674298,"state":"Dead"},{"shard_id":1,"peer_id":1485700002748332,"state":"Active"},{"shard_id":2,"peer_id":857928665674298,"state":"Dead"}]}

What you see: the two copies on qdrant-1 (peer 857928665674298) are Dead: they missed writes. Qdrant no longer sends them read requests.

Step 5 – the return. Check whether qdrant-1 is running again and read its new IP.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (excerpt – only the columns NAME, STATUS, IP and NODE; your IPs will differ):

NAME STATUS IP NODE
qdrant-0 Running 10.42.1.22 vdb2
qdrant-1 Running 10.42.3.13 vdb4
qdrant-2 Running 10.42.2.11 vdb3

Now ask all three peers for their shards as in Drill 5.

Expected:

{"peer_id":121400021250061,"lokal":[{"shard_id":0,"points_count":4109,"state":"Active"},{"shard_id":2,"points_count":4447,"state":"Active"}]}
{"peer_id":857928665674298,"lokal":[{"shard_id":1,"points_count":4724,"state":"Active"},{"shard_id":2,"points_count":4447,"state":"Active"}]}
{"peer_id":1485700002748332,"lokal":[{"shard_id":0,"points_count":4109,"state":"Active"},{"shard_id":1,"points_count":4724,"state":"Active"}]}

What you see: all copies Active again, and each shard has the same number of points on both peers – 13,280 in total, that is 13,220 plus 60 test points. Even the points written while qdrant-1 was missing have arrived on its copies.

Step 6 – how the gap was closed.

# on vdb1
kubectl -n qdrant logs qdrant-0 --since=10m

--since=10m shows only the lines from the last ten minutes.

Expected (excerpt – look for the line with Transfer of shard):

2026-12-05T10:04:09.577009Z  INFO collection::shards::transfer::transfer_tasks_pool: Transfer of shard verteilt:2 -> 857928665674298 finished

The detailed lines before it contain method: Some(WalDelta): Qdrant did not resend the whole shard as in Drill 3, but only the missed entries from the write-ahead log (Day 3). The pod came back up at 10:03:59; by 10:04:09 the last copy had been restocked.

Remember: if a building is missing, Qdrant keeps writing and closes its shelves (Dead). When it comes back, Qdrant delivers only the missed pages (WalDelta) – no rebuild.

Save your progress? Sign up for free

Drill 7: How many buildings do you ask?

Where you are: on vdb1.

What you have afterwards: the limit of consistency with two copies.

When reading, you can demand that several replicas answer and agree: consistency=all (all copies), majority (the majority) or a number. Without it, one is enough.

Step 1 – restart a peer.

# on vdb1
kubectl -n qdrant delete pod qdrant-2 --wait=false

Step 2 – read with consistency=all.

# on vdb1
curl -s -X POST 'http://10.42.1.22:6333/collections/verteilt/points/query?consistency=all' -H 'Content-Type: application/json' -d '{"query": 1702, "limit": 3}'

Expected:

{"status":{"error":"Service internal error: 1 of 2 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-2.qdrant-headless:6335/, error: transport error\""},"time":0.897458993}

Step 3 – with consistency=majority.

# on vdb1
curl -s -X POST 'http://10.42.1.22:6333/collections/verteilt/points/query?consistency=majority' -H 'Content-Type: application/json' -d '{"query": 1702, "limit": 3}'

Expected:

{"status":{"error":"Service internal error: 1 of 2 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-2.qdrant-headless:6335/, error: transport error\""},"time":0.41340826}

Step 4 – without it.

# on vdb1
curl -s -X POST 'http://10.42.1.22:6333/collections/verteilt/points/query' -H 'Content-Type: application/json' -d '{"query": 1702, "limit": 3}' -o q.json
# on vdb1
jq -c '[.result.points[].id], .time' q.json

Expected:

[1776,2674,3192]
0.033642167

What you see: with two copies the majority is two – so majority demands the same as all and fails as soon as a building is missing. Only the default setting (one answer is enough) delivers. The same three neighbors of 1702 as on Day 4.

Remember: majority only protects against a failure from three copies upward. With replication_factor 2, any stricter read consistency means: one missing building brings the query to a halt.

Save your progress? Sign up for free

Diagnosis task: “But we have three replicas”

A colleague reports: on every update of the Qdrant StatefulSet there are errors “1 of 1 read operations failed” for half a minute – although replicaCount: 3 is set and all three pods are running. His collection was created when Qdrant was still a single pod.

Find the cause and the fix before you read on.

Solution, step by step.

  1. The error message counts along: “1 of 1” means there was exactly one replica that could have answered.
  2. curl -s http://<peer>:6333/collections/<name>/cluster shows the truth: one shard, in local_shards on only one peer, on the others only as remote_shards – exactly like doku in Drill 2.
  3. replication_factor in the configuration does not help on its own (Drill 2, Step 4).

The fix: replicate_shard for each shard to a second peer (Drill 3), then check with /collections/<name>/cluster that each shard is Active twice – on different nodes. And for new collections, set replication_factor 2 right at creation.

Remember: “1 of 1 read operations failed” is a counter, not a riddle: there was only one copy.

Cleanup and checkpoint

You delete the 60 test points via their marker:

# on vdb1
curl -s -X POST 'http://10.43.151.237:6333/collections/verteilt/points/delete?wait=true' -H 'Content-Type: application/json' -d '{"filter": {"must": [{"key": "bereich", "match": {"value": "test"}}]}}'

Expected:

{"result":{"operation_id":77,"status":"completed"},"status":"ok","time":0.052243969}
# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/verteilt/points/count -H 'Content-Type: application/json' -d '{"exact": true}'

Expected: "count":13220.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected: three pods Running, one each on vdb2, vdb3 and vdb4.

# on vdb1
curl -s http://10.43.151.237:6333/collections/doku -o doku.json
# on vdb1
jq -c '{status: .result.status, p: .result.config.params | {shard_number, replication_factor}}' doku.json

Check for doku and verteilt: status green; doku with shard_number 1 and replication_factor 2, verteilt with 3 and 2. And with /collections/<name>/cluster: each shard Active twice, on different peers.

Test yourself

  1. You scale Qdrant from one to three pods. What happens to an existing collection?
  2. How do you tell whether a shard has a second copy?
  3. Why is PATCH … {"params": {"replication_factor": 2}} not enough?
  4. Two replicas of the same shard deliver slightly different recall. A bug?
  5. A peer fails, write_consistency_factor is 1. What happens when writing, and afterwards?
  6. Why does consistency=majority with two copies already fail when one peer is missing?

Answers:

  1. Nothing. It stays with its shards on the old peer; the new peers know it only as a reference.
  2. From /collections/<name>/cluster: the shard must be Active on two peers – local on one, as a remote_shards entry with a different peer_id on the other.
  3. The value applies to newly created shards. Existing shards are copied with replicate_shard.
  4. No. Each replica builds its own HNSW index; after the transfer, the optimizer merged the segments differently (4 versus 2).
  5. The write succeeds, the copies on the missing peer become Dead. When it comes back, it catches up on the missed entries via WalDelta and becomes Active again.
  6. The majority of two is two. majority then demands both copies – like all.

Interview note

“How do you make Qdrant highly available on Kubernetes?” – At least three peers, placed on different nodes with pod anti-affinity, so the Raft consensus keeps a majority. Then the collections: replication_factor of at least 2 at creation, and for existing collections replicate shards explicitly. Verify not via the pod list, but via /collections/<name>/cluster: each shard Active twice, on different nodes. Choose consistency deliberately – majority only pays off from three copies upward. And measure the failure, don’t assume it.

Enterprise note

In production, replication is defined in the code that creates collections (Day 15), and a check runs regularly: shards with only one Active copy or copies in state Dead are an alert (Day 11). Anti-affinity goes beyond nodes to racks or zones (topology.kubernetes.io/zone), otherwise second copies share a power circuit. Capacity is planned with the replication factor: two copies mean double the storage and double the write load. And read consistency is a product decision: a search that would rather answer than fail when a node is missing is the right one for most applications.

Summary

  • replicaCount: 3 with anti-affinity resulted in three peers on three nodes with one Raft leader.
  • doku nevertheless remained one shard on one peer. Restarting that pod: about 20 seconds of “1 of 1 read operations failed”.
  • replication_factor 2 via PATCH only changed the configuration. Only replicate_shard created the copy (snapshot, 26.49 MiB, about eight seconds). The same failure afterwards: no error.
  • The copies have the same points, but their own indexes: recall 0.992 versus 0.975.
  • verteilt (3 shards × 2 copies): two shard copies per peer, search about 18 ms instead of 10–12 ms.
  • Writing with a missing peer succeeded; its copies became Dead and were restocked via WalDelta.
  • consistency=majority and all failed with two copies and one missing peer.

Commands at a glance

Command Purpose
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml roll out Qdrant with three pods
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s wait until all pods are new and ready
curl -s http://<pod-ip>:6333/cluster -o cluster.json peers, leader, Raft state
curl -s http://<pod-ip>:6333/collections/<name>/cluster shards and replicas from one peer’s view
curl -s -X PATCH …/collections/doku -d '{"params": {"replication_factor": 2}}' change the target value (copies nothing)
curl -s -X POST …/collections/doku/cluster -d '{"replicate_shard": {…}}' copy a shard to another peer
curl -s -X PUT …/collections/verteilt -d '{… "shard_number": 3, "replication_factor": 2 …}' create a distributed collection
kubectl -n qdrant delete pod qdrant-0 --wait=false trigger a pod restart
~/werkbank/bin/python schreiben.py <url> <collection> <start-id> write 30 test points
kubectl -n qdrant logs qdrant-0 --since=10m look up shard transfers in the log
curl -s -X POST '…/points/query?consistency=all' -d '{"query": 1702, "limit": 3}' read with strict consistency

Contents

More