Day 12: Backup and Restore
Goal: Back up the collection
wissenand the PostgreSQL databaserag, then cause real damage (collection deleted, table dropped), restore both and measure with clock times what was lost (RPO) and how long the desk was gone (RTO) – in production and in a fresh, empty environment · Duration: approx. 90 min · Prerequisite: Day 11
State before this chapter
First you check that all services from Day 11 are running. Today you
work with qdrant-0, qdrant-1,
pg-1, the answer service and the helper pod
curl.
# on rag1
kubectl -n rag get pods -o wide --field-selector=status.phase=Running--field-selector=status.phase=Running– only running pods; the finished jobs of the last days stay out.
Expected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-b4c788ff5-2lxqs 1/1 Running 1 (139m ago) 141m 10.42.1.2 rag2
antwort-b4c788ff5-8t6bm 1/1 Running 0 141m 10.42.0.62 rag1
curl 1/1 Running 0 152m 10.42.0.56 rag1
embed-66bdc7c6c9-rqqpn 1/1 Running 1 (5h54m ago) 23h 10.42.0.33 rag1
llm-579476976d-6rx9d 1/1 Running 0 3h9m 10.42.0.50 rag1
pg-1 1/1 Running 1 (139m ago) 143m 10.42.1.3 rag2
qdrant-0 1/1 Running 0 139m 10.42.1.4 rag2
qdrant-1 1/1 Running 0 152m 10.42.0.58 rag1
What you see: Two Qdrant pods on two nodes,
PostgreSQL pg-1 on rag2, two answer services, embedding
service and language model on rag1. Your names, ages and IP addresses
differ – what matters is that all eight pods show
1/1 Running.
Introduction
Since yesterday the collection wissen has two copies on
two nodes. If a node fails, the desk keeps searching. Today is about the
other big case: somebody deletes something – by
mistake, with a wrong script, with a command in the wrong terminal. The
replica does not help against this. It copies the mistake as fast as any
other change.
Only a backup helps: a copy taken at a certain point in time that is not changed afterwards. Today you take such a backup of Qdrant and of PostgreSQL, then add one more card, then really delete the collection and the table – and restore the backup. With a clock in hand you measure two numbers found in every operations concept:
- RPO (Recovery Point Objective): how much data is lost? Everything added after the backup.
- RTO (Recovery Time Objective): how long was the desk gone? From the damage to the first correct answer.
Today you learn:
- which data of your RAG pipeline lives where and what of it must be backed up,
- to take a snapshot of a Qdrant collection, download it and check it against its checksum,
- why a snapshot that only sits in the Qdrant pod is not a backup yet,
- to back up PostgreSQL with
pg_dumpand look at the content of the backup withpg_restore --list, - that a replica deletes a deleted collection on both peers,
- to restore a snapshot by upload and watch Qdrant create the second copy on its own,
- why
pg_restore -tbrings a table back without indexes – and how you add them, - to build a fresh environment from the backups and state RPO and RTO in seconds.
Background
The picture for today: the microfilm archive
Since yesterday the library has two card cabinets in two buildings. Today it gets a microfilm archive.
Once a day – today once by hand – an archivist photographs every drawer: all cards, all stamps, the register. The film goes into an archive outside the cabinets. From that moment on the film does not change any more, whatever happens to the cabinets.
Then operations go on. A new card arrives. And then somebody empties a drawer. Because the two cabinets keep each other in sync, the drawer is empty in both buildings.
Now the archivist fetches the film, prints the cards again and puts them back. Afterwards every library manager asks two questions:
- What is missing? Everything added after the film was taken – the new card is not on the film. That is the RPO.
- How long was the desk without cards? From emptying the drawer until the desk answers correctly again. That is the RTO.
At the end the archivist rehearses the worst case: an empty room with new, empty cabinets. Only the film is there. Is it enough to rebuild the desk?
The terms
| Term | Meaning | in the picture |
|---|---|---|
| snapshot (Qdrant) | a file with the complete content of a collection on one peer: points, vectors, payload, indexes, settings | the microfilm of a drawer |
dump (pg_dump) |
a file with tables, rows and indexes of a PostgreSQL database | the microfilm of the card ledger |
| checksum (sha256) | a number that changes as soon as a single byte of the file changes | inspection stamp on the film can |
emptyDir |
a folder that is created with the pod and deleted with it | film left lying in the cabinet |
| upload / restore | play a backup back into the database | print new cards from the film |
| RPO | how much data is lost in the worst case: everything since the last backup | what was added after the film |
| RTO | how long the service is gone after damage | time without cards at the desk |
| fresh environment | an empty namespace with new databases | the empty room with new cabinets |
Remember: A replica protects against the failure of a building, a backup against the mistake of a person. The replica repeats every mistake, the film does not.
Drill 1: What goes on the microfilm
Where you are: on rag1.
What you have afterwards: a list of the data you back up today, and the answer to the question where Qdrant puts its snapshots.
In this drill: you walk through the library once and write down what stands in which cabinet – before you photograph anything.
Step 1 – the folder for today. All files of this day
go into ~/kurs/12.
# on rag1
mkdir -p ~/kurs/12# on rag1
cd ~/kurs/12Step 2 – which collections exist. You ask Qdrant via
the helper pod curl for all collections and save the answer
in a file.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections > sammlungen.jsonexec curl -- curl -s …– run the programcurlin the podcurl;-ssuppresses the progress display,> sammlungen.json– the answer ends up in a file on rag1.
Now you read only the names from the file.
# on rag1
jq '.result.collections[].name' sammlungen.json.result.collections[]– every element of the list,.name– only its name.
Expected:
"handbuch"
"wissen"
"wissen-2000"
"wissen-500"
"wissen-ohne-kontext"
"wissen-ohne-ueberlappung"
What you see: Six collections. The answer service
only works with wissen. handbuch holds the
four index cards from Day 4. The other four are measurement series from
Day 7 – they can be recreated at any time with the ingestion job and do
not go on the microfilm today.
Step 3 – how much is in wissen. You
fetch the description of the collection. You need it later for
comparison: after the restore exactly this must be there again.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/wissen > wissen.json# on rag1
jq '.result | {status, points_count, payload_schema}' wissen.json{status, points_count, payload_schema}– only these three fields of the result.
Expected:
{
"status": "green",
"points_count": 173,
"payload_schema": {
"text": {
"data_type": "text",
"params": {
"type": "text",
"tokenizer": "word",
"scoring": {
"type": "bm25"
}
},
"points": 173
},
"quelle": {
"data_type": "keyword",
"points": 173
}
}
}
| Field | Value | Meaning |
|---|---|---|
points_count |
173 | that many cards the ingestion from Day 6 wrote |
payload_schema.quelle |
keyword |
the index for filters on the source (Day 6) |
payload_schema.text |
text, bm25 |
the full-text index from Day 8 |
The two indexes are part of the collection. A good backup brings them back – you check that in Drill 6.
Step 4 – the second cabinet with cards. The same for
handbuch.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/handbuch > handbuch.json# on rag1
jq '.result | {status, points_count}' handbuch.jsonExpected:
{
"status": "green",
"points_count": 4
}
Step 5 – what lives in PostgreSQL. Since Day 5
PostgreSQL holds the same four index cards with vectors in the table
karten. \dt+ lists all tables with their
size.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag -c "\dt+"-c postgres– the containerpostgresin the pod,psql -d rag– connect to the databaserag,-c "\dt+"– run this one command: tables with size.
Expected:
List of tables
Schema | Name | Type | Owner | Persistence | Access method | Size | Description
--------+--------+-------+----------+-------------+---------------+-------+-------------
public | karten | table | postgres | permanent | heap | 72 kB |
(1 row)
Now you look at the rows. left(text, 40) shows only the
first 40 characters of each card.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag \
-c "SELECT id, abteilung, left(text, 40) AS anfang FROM karten ORDER BY id;"Expected:
id | abteilung | anfang
----+-----------+------------------------------------------
1 | IT | Druckdienst neu starten: Melde dich am D
2 | IT | VPN-Zugang einrichten: Lade das Profil f
3 | Personal | Urlaub beantragen: Trage den Urlaub im P
4 | IT | Backup wiederherstellen: Die Sicherungen
(4 rows)
What you see: One table, four rows. Small – but a
database with an extension (vector), a primary key and the
HNSW index from Day 5. All of that should be in the backup.
Step 6 – where Qdrant puts its snapshots. Qdrant
writes snapshots into the folder /qdrant/snapshots of the
pod. Before you take one, you want to know what kind of folder that is.
describe shows the volumes of the pod.
# on rag1
kubectl -n rag describe pod qdrant-0Expected (excerpt – the section
Volumes):
Volumes:
qdrant-storage:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: qdrant-storage-qdrant-0
ReadOnly: false
qdrant-config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: qdrant
Optional: false
qdrant-snapshots:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
What you see: The cards live on the volume
qdrant-storage (the PersistentVolume from Day 4). The
snapshots, however, land in an EmptyDir –
“a temporary directory that shares a pod’s lifetime”. That is the
default of the Helm chart
(snapshotPersistence.enabled: false). A snapshot left there
is a film the archivist forgets in the cabinet. In the diagnosis task
you see what happens to it when the pod restarts.
Remember: First write down what to back up and where the backup goes. Today:
wissenandhandbuchfrom Qdrant, the databaseragfrom PostgreSQL – and everything must leave the pod.
Save your progress? Sign up for free
Drill 2: Photographing the card cabinet
Where you are: on rag1, in
~/kurs/12.What you have afterwards: two snapshot files of
wissenandhandbuchin the folder~/kurs/12/sicherung, with a verified checksum.
In this drill: you let Qdrant take a film of each collection, carry the film out of the pod into the archive on rag1 and check the stamp on the can.
Step 1 – the archive. The folder
sicherung lives on rag1 outside Kubernetes. In operations
this would be another machine or an object store; in the lab a separate
folder is enough.
# on rag1
mkdir -p sicherungStep 2 – note the time. For the RPO you later need
the time of the backup. date -u shows the time in UTC,
+%T only hours, minutes and seconds.
# on rag1
date -u +%TExpected (a different time for you – write it down):
19:30:02
Step 3 – take the snapshot of wissen. A
POST to /collections/wissen/snapshots makes
Qdrant take the film. You send it specifically to qdrant-0
via the headless service: a snapshot is created on the
peer you ask and afterwards only lives there. Through
qdrant.rag you would not know which peer it was.
# on rag1
kubectl -n rag exec curl -- curl -s -X POST \
"http://qdrant-0.qdrant-headless:6333/collections/wissen/snapshots?wait=true" \
> snap-wissen.json-X POST– create a new snapshot,qdrant-0.qdrant-headless– exactly the podqdrant-0,?wait=true– only answer when the file is completely written.
# on rag1
jq . snap-wissen.jsonExpected:
{
"result": {
"name": "wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot",
"creation_time": "2026-12-02T19:30:03",
"size": 2189824,
"checksum": "8b931c7c99623cb7510014882d35fe04a36fceb3f9676cc55692d457a23c71eb"
},
"status": "ok",
"time": 0.538130545
}
| Field | Value | Meaning |
|---|---|---|
name |
wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot |
collection, peer number of qdrant-0, date, time (UTC)
and a sequence number |
creation_time |
19:30:03 |
the time of the film – the RPO counts from here |
size |
2189824 | 2.1 MB for 173 cards with 1024 numbers each |
checksum |
8b93…71eb |
the SHA-256 checksum Qdrant calculated over the file |
Your name looks different: the long number is the peer
number of your qdrant-0 (you know it from Day 11,
/cluster), plus your time. Copy your name from your
snap-wissen.json – you need it in a moment.
Step 4 – the same film for
handbuch.
# on rag1
kubectl -n rag exec curl -- curl -s -X POST \
"http://qdrant-0.qdrant-headless:6333/collections/handbuch/snapshots?wait=true" \
> snap-handbuch.json# on rag1
jq . snap-handbuch.jsonExpected:
{
"result": {
"name": "handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshot",
"creation_time": "2026-12-02T19:30:04",
"size": 99328,
"checksum": "afa0407a19c4ed749ee1f5eb021877e2c7f77dae6a1ba4587e637b5021b00364"
},
"status": "ok",
"time": 0.06236839
}
Four cards, 99 KB. Here too: copy the name from your file.
Step 5 – get the film out of the pod. A
GET on the name returns the file. You let it flow through
kubectl exec to rag1 and write it into the folder
sicherung. Put your name from step 3 into
URL and file name. The URL cannot be broken, so the second line is
long.
# on rag1
kubectl -n rag exec curl -- curl -s \
http://qdrant-0.qdrant-headless:6333/collections/wissen/snapshots/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot \
> sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot…/snapshots/<name>– the snapshot file itself, again directly fromqdrant-0,> sicherung/<name>– binary data passes throughkubectl execjust like text; it lands unchanged in the file.
The same for handbuch, with your name from step 4:
# on rag1
kubectl -n rag exec curl -- curl -s \
http://qdrant-0.qdrant-headless:6333/collections/handbuch/snapshots/handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshot \
> sicherung/handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshotNow you check that both files are there and how big they are.
# on rag1
ls -l sicherungExpected:
total 2240
-rw-rw-r-- 1 ubuntu ubuntu 99328 Dec 2 19:30 handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshot
-rw-rw-r-- 1 ubuntu ubuntu 2189824 Dec 2 19:30 wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot
What you see: The same sizes as in size
– 2189824 and 99328 bytes.
Step 6 – check the stamp on the can. Same size does
not mean same content. sha256sum calculates the checksum of
the file on rag1 itself. If it matches checksum from step
3, not a single byte was lost on the way.
# on rag1
sha256sum sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshotExpected:
8b931c7c99623cb7510014882d35fe04a36fceb3f9676cc55692d457a23c71eb sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot
# on rag1
sha256sum sicherung/handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshotExpected:
afa0407a19c4ed749ee1f5eb021877e2c7f77dae6a1ba4587e637b5021b00364 sicherung/handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshot
What you see: Both checksums are identical character
by character to those in snap-wissen.json and
snap-handbuch.json. Compare the first and last four
characters on your machine – that is enough for the eye.
Step 7 – look inside the film. A Qdrant snapshot is
an ordinary tar archive. tar -tvf lists the content without
unpacking anything.
# on rag1
tar -tvf sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot-t– only list,-v– with size and date,-f <file>– this archive.
Expected:
-rw-r--r-- 0/0 564736 1970-01-01 00:00 0/segments/156d9be8-ce7d-4f78-ba43-1f09bab9c85d.tar
-rw-r--r-- 0/0 564736 1970-01-01 00:00 0/segments/8eec6e4a-7d39-460e-9204-bfc4bc5899d8.tar
-rw-r--r-- 1000/3000 188 2026-12-02 17:10 0/newest_clocks.json
-rw-rw-r-- 1000/3000 33554432 2026-12-02 17:06 0/wal/open-1
-rw-rw-r-- 1000/3000 33554432 2026-12-01 21:00 0/wal/open-2
-rw-rw-r-- 1000/3000 16 2026-12-02 17:06 0/wal/first-index
-rw-r--r-- 0/0 115 1970-01-01 00:00 0/replica_state.json
-rw-r--r-- 0/0 21 1970-01-01 00:00 0/shard_config.json
-rw-r--r-- 0/0 5 1970-01-01 00:00 version.info
-rw-r--r-- 0/0 695 1970-01-01 00:00 config.json
-rw-r--r-- 0/0 2 1970-01-01 00:00 shard_key_mapping.json
-rw-r--r-- 0/0 99 1970-01-01 00:00 payload_index.json
| Entry | Meaning |
|---|---|
0/segments/…tar |
the cards themselves: vectors, payload, HNSW – shard 0 in two segments |
0/wal/… |
the write-ahead log of the shard; tar shows the reserved size of 32 MiB, yet the whole archive is only 2.1 MB |
config.json |
settings of the collection: dimension, distance,
replication_factor |
payload_index.json |
the payload indexes quelle and text |
What you see: There is only one shard
(0/). qdrant-0 has a complete copy of it (Day
11), so this film holds the whole collection. If a collection had
several shards on different peers, you would need a film from each
peer.
Remember: A snapshot is only a backup once it lives outside the pod and its checksum matches. Until then it is a film lying in the cabinet.
Save your progress? Sign up for free
Drill 3: Backing up the card ledger
Where you are: on rag1, in
~/kurs/12.What you have afterwards: the file
sicherung/rag.dumpwith the whole databaseragand a list of its content.
In this drill: you take the film of the second store, PostgreSQL, and read the film’s table of contents.
Step 1 – note the time.
# on rag1
date -u +%TExpected (write down your time):
19:30:14
Step 2 – back up the database. pg_dump
reads the database and writes everything needed to rebuild it. The
program runs in the pod pg-1; the output flows through
kubectl exec into a file on rag1.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- \
pg_dump -Fc -d rag > sicherung/rag.dump-Fc– PostgreSQL’s own compressed format (“custom”); only with it canpg_restorelater pick individual parts,-d rag– the databaserag,> sicherung/rag.dump– the backup lands in the archive on rag1.
Without an error nothing comes back. You check the size.
# on rag1
ls -l sicherung/rag.dumpExpected:
-rw-rw-r-- 1 ubuntu ubuntu 24087 Dec 2 19:30 sicherung/rag.dump
Step 3 – read the table of contents.
pg_restore --list reads a backup and shows what is in it –
without restoring anything. PostgreSQL is not installed on rag1, so this
command also runs in the pod; -i passes the file in via
standard input.
# on rag1
kubectl -n rag exec -i pg-1 -c postgres -- \
pg_restore --list < sicherung/rag.dump-i– pass your input to the command in the pod,--list– only print the table of contents,< sicherung/rag.dump– this file is the input.
Expected:
;
; Archive created at 2026-12-02 19:30:15 UTC
; dbname: rag
; TOC Entries: 10
; Compression: gzip
; Dump Version: 1.16-0
; Format: CUSTOM
; Integer: 4 bytes
; Offset: 8 bytes
; Dumped from database version: 18.7 (Debian 18.7-1.pgdg13+5)
; Dumped by pg_dump version: 18.7 (Debian 18.7-1.pgdg13+5)
;
;
; Selected TOC Entries:
;
2; 3079 16389 EXTENSION - vector
4339; 0 0 COMMENT - EXTENSION vector
220; 1259 16717 TABLE public karten postgres
4332; 0 16717 TABLE DATA public karten postgres
4184; 2606 16724 CONSTRAINT public karten karten_pkey postgres
4182; 1259 16734 INDEX public karten_hnsw postgres
| Line | Meaning |
|---|---|
Archive created at … 19:30:15 |
the time of the film – for PostgreSQL the RPO counts from here |
EXTENSION - vector |
the pgvector extension |
TABLE public karten |
the empty table with its columns |
TABLE DATA public karten |
the rows |
CONSTRAINT … karten_pkey |
the primary key |
INDEX … karten_hnsw |
the HNSW index from Day 5 |
What you see: Six entries – extension, table, data, key, index. Note that table, data and index are separate entries. In Drill 6 this becomes important.
Remember:
pg_dump -Fcmakes a film from which you can later pick individual parts.pg_restore --listshows which parts are on it – read it before you need it.
Save your progress? Sign up for free
Drill 4: Operations go on
Where you are: on rag1, in
~/kurs/12.What you have afterwards: a new card about the maintenance window in
wissen(point 1201) and inkarten(row 5) that is not on the film – and a desk that answers the maintenance question.
In this drill: after the photographing, a new card arrives in the library. It is the piece you will miss later.
Step 1 – the text of the new card. The card is a request to the embedding service – in the same format as on Day 1: model and a list of texts. The text stays German like all cards of the practice company.
# on rag1
nano nachtrag-anfrage.json{
"model": "bge-m3",
"input": [
"Wartungsfenster: Der Kubernetes-Cluster wird jeden Dienstag von 18 bis 20 Uhr gewartet. In dieser Zeit starten die Knoten nacheinander neu, und die Auskunft kann kurz ausfallen. Fragen dazu beantwortet das Plattform-Team."
]
}In English: “Maintenance window: the Kubernetes cluster is maintained every Tuesday from 6 to 8 pm. During this time the nodes restart one after another and the desk may be briefly unavailable. The platform team answers questions about it.”
Step 2 – get the vector. The embedding service from Day 3 turns the text into 1024 numbers.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s http://embed.rag:11434/api/embed \
-H 'Content-Type: application/json' -d @- \
< nachtrag-anfrage.json > nachtrag-embed.json-d @-– read the request body from standard input;-ionkubectl execpasses it through,< nachtrag-anfrage.json– that is the input,> nachtrag-embed.json– the answer with the vector.
You check the length of the vector.
# on rag1
jq '.embeddings[0] | length' nachtrag-embed.jsonExpected:
1024
Step 3 – build the point for Qdrant. A Qdrant point
needs an ID, the vector and the payload with the same fields as the
cards of the ingestion (quelle, titel,
abschnitt, nr, lizenz,
text). You put the jq program for this in a file so that it
stays readable.
# on rag1
nano nachtrag-punkt.jq{
points: [
{
id: 1201,
vector: .embeddings[0],
payload: {
quelle: "nachtrag-wartung.txt",
titel: "Wartungsfenster",
abschnitt: "Wartungsfenster",
nr: 0,
lizenz: "Übungsfirma",
text: $a[0].input[0]
}
}
]
}| Line | Setting | Meaning |
|---|---|---|
| 4 | id: 1201 |
Qdrant allows a number or a UUID as ID; the number is easy to find again |
| 5 | .embeddings[0] |
the vector from the input file nachtrag-embed.json |
| 7–11 | quelle … lizenz |
the same stamps as on every card; the answer service shows
quelle and abschnitt |
| 12 | $a[0].input[0] |
the text from nachtrag-anfrage.json; $a
comes from the option --slurpfile |
Now you let jq run the program.
# on rag1
jq --slurpfile a nachtrag-anfrage.json -f nachtrag-punkt.jq \
nachtrag-embed.json > nachtrag-punkt.json--slurpfile a nachtrag-anfrage.json– read the file and provide it in the program as$a(a list),-f nachtrag-punkt.jq– take the program from this file,nachtrag-embed.json– the actual input that.embeddingsrefers to.
A quick look whether everything is in it – without the 1024 numbers:
# on rag1
jq -c '.points[0] | {id, abschnitt: .payload.abschnitt, dim: (.vector | length)}' \
nachtrag-punkt.json-c– compact on one line.
Expected:
{"id":1201,"abschnitt":"Wartungsfenster","dim":1024}
Step 4 – put the card in. A PUT on
/points writes the point into wissen. Via
qdrant.rag it reaches one of the peers, which passes it on
to the other.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X PUT 'http://qdrant.rag:6333/collections/wissen/points?wait=true' \
-H 'Content-Type: application/json' -d @- < nachtrag-punkt.json?wait=true– only answer when the point is written.
Expected:
{"result":{"operation_id":29,"status":"completed"},"status":"ok","time":0.016617314}
Right after that you note the time – this is when the card was created.
# on rag1
date -u +%TExpected (write down your time):
19:30:34
Step 5 – count again. This time you ask
qdrant-1 to see that the card is also in the second
cabinet.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen > wissen.json# on rag1
jq .result.points_count wissen.jsonExpected:
174
Step 6 – the same card for PostgreSQL. As on Day 5, jq builds an SQL line from text and vector. The program is a single string.
# on rag1
nano nachtrag-sql.jq"INSERT INTO karten VALUES (5, $q$IT$q$, $q$\($a[0].input[0])$q$, $q$\(.embeddings[0] | tojson)$q$);"| Part | Meaning |
|---|---|
INSERT INTO karten VALUES (5, …) |
a new row with ID 5 |
$q$…$q$ |
PostgreSQL dollar quoting: everything in between is text, colons and commas included |
\(…) |
jq inserts a value here: the text from $a or the
vector |
.embeddings[0] \| tojson |
the vector as […] – the format pgvector reads |
# on rag1
jq -r --slurpfile a nachtrag-anfrage.json -f nachtrag-sql.jq \
nachtrag-embed.json > nachtrag.sql-r– output raw text, without quotes around it.
A look at the beginning of the file:
# on rag1
head -c 160 nachtrag.sql-c 160– only the first 160 characters; 1024 numbers would follow.
Expected:
INSERT INTO karten VALUES (5, $q$IT$q$, $q$Wartungsfenster: Der Kubernetes-Cluster wird jeden Dienstag von 18 bis 20 Uhr gewartet. In dieser Zeit starten die Kn
Now psql runs the line.
# on rag1
kubectl -n rag exec -i pg-1 -c postgres -- psql -d rag < nachtrag.sqlExpected:
INSERT 0 1
# on rag1
date -u +%TExpected (write it down):
19:30:36
To check, the table:
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag \
-c "SELECT id, abteilung, left(text, 40) AS anfang FROM karten ORDER BY id;"Expected:
id | abteilung | anfang
----+-----------+------------------------------------------
1 | IT | Druckdienst neu starten: Melde dich am D
2 | IT | VPN-Zugang einrichten: Lade das Profil f
3 | Personal | Urlaub beantragen: Trage den Urlaub im P
4 | IT | Backup wiederherstellen: Die Sicherungen
5 | IT | Wartungsfenster: Der Kubernetes-Cluster
(5 rows)
Step 7 – the desk is asked. You ask the answer service the question only the new card can answer (“When is the maintenance window for the Kubernetes cluster?”). You create the question as a file.
# on rag1
nano wartung.json{"frage": "Wann ist das Wartungsfenster für den Kubernetes-Cluster?"}# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- \
< wartung.json > wartung-antwort.json# on rag1
jq . wartung-antwort.jsonExpected:
{
"antwort": "[1] Das Wartungsfenster für den Kubernetes-Cluster ist jeden Dienstag von 18 bis 20 Uhr.",
"quellen": [
{
"nr": 1,
"quelle": "nachtrag-wartung.txt",
"abschnitt": "Wartungsfenster",
"score": 0.739
},
{
"nr": 2,
"quelle": "k8s-pod-lifecycle.md",
"abschnitt": "Detection of kubelet restarts",
"score": 0.574
},
{
"nr": 3,
"quelle": "k8s-pod-lifecycle.md",
"abschnitt": "Pods and fault recovery",
"score": 0.553
}
],
"sekunden": {
"suche": 0.81,
"gesamt": 11.25
}
}
What you see: The new card leads with 0.739, the
answer (“every Tuesday from 6 to 8 pm”) is correct and names the source
[1]. The next best card has 0.574 – above the threshold
MINDEST_SCORE 0.46 from Day 9, but without the answer. Your
times differ.
Remember: Every change after the film is unprotected. If you want to know what you can lose, look at the time of the last backup, not the next one.
Save your progress? Sign up for free
Drill 5: The damage
Where you are: on rag1, in
~/kurs/12.What you have afterwards: a deleted collection
wissen, a dropped tablekartenand an answer service that returns nothing.
In this drill: somebody empties the drawer and tears the pages out of the card ledger. You do it yourself, with real commands.
Before you delete – your prediction:
- Since Day 11,
wissenstands in two cabinets on two nodes. You send a singleDELETEto the serviceqdrant.rag. How many cards remain onqdrant-1?- What does a user get who then asks the Secret question – an error message, “Dazu steht nichts im Handbuch” (nothing about it in the handbook) or nothing at all?
Write down both answers.
Step 1 – time of the damage. From this moment the clock runs for the RTO.
# on rag1
date -u +%TExpected (write it down):
19:31:11
Step 2 – delete the collection. A
DELETE on the collection – the same command that might
stand in a cleanup script with the wrong name.
# on rag1
kubectl -n rag exec curl -- \
curl -s -X DELETE http://qdrant.rag:6333/collections/wissen-X DELETE– remove the whole collection with all points. Qdrant does not ask.
Expected:
{"result":true,"status":"ok","time":0.163403587}
Step 3 – drop the table.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag -c "DROP TABLE karten;"Expected:
DROP TABLE
# on rag1
date -u +%TExpected:
19:31:13
Step 4 – what is left in the two cabinets. You ask each peer separately.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-0.qdrant-headless:6333/collections/wissenExpected:
{"status":{"error":"Not found: Collection `wissen` doesn't exist!"},"time":0.000065736}
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissenExpected:
{"status":{"error":"Not found: Collection `wissen` doesn't exist!"},"time":0.000046522}
What you see: wissen is gone on both
peers. Deleting a collection is a change to the inventory, and the Raft
house council from Day 11 decides it for all peers. The
replica copied the mistake as faithfully as any new card.
Step 5 – the table.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag \
-c "SELECT count(*) FROM karten;"Expected:
ERROR: relation "karten" does not exist
LINE 1: SELECT count(*) FROM karten;
^
command terminated with exit code 1
Step 6 – what a user experiences. You fetch the Secret question from Day 9 and ask it.
# on rag1
cp ~/kurs/09/f02.json .# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- < f02.jsonExpected:
command terminated with exit code 52
What you see: No answer, no error message –
curl exits with code 52. According to the curl
manual that means “Empty reply from server”: the connection was made,
but the server closed it without a single byte. Why, the log of the
answer service shows.
# on rag1
kubectl -n rag logs -l app=antwort --prefix --tail=6-l app=antwort– the logs of all pods with this label, i.e. both answer services,--prefix– put the pod name in front of every line,--tail=6– the last six lines per pod.
Expected (excerpt – the pod that got the question; for you it may be the other one):
[pod/antwort-b4c788ff5-2lxqs/antwort] File "/usr/local/lib/python3.14/urllib/request.py", line 611, in http_error_default
[pod/antwort-b4c788ff5-2lxqs/antwort] raise HTTPError(req.full_url, code, msg, hdrs, fp)
[pod/antwort-b4c788ff5-2lxqs/antwort] urllib.error.HTTPError: HTTP Error 404: Not Found
[pod/antwort-b4c788ff5-2lxqs/antwort] ----------------------------------------
What you see: Qdrant answers the search with
404 Not Found. The answer service from Day 9 catches errors
of the language model, but not this one – the Python program aborts the
request, and the user gets an empty line. /health still
reports ok, because the service itself is running. A health
check says nothing about whether the cards are still there.
Resolving your prediction:
- Zero. Qdrant reported success after 0.16 seconds; one second later
wissenwas gone onqdrant-0andqdrant-1.- Nothing at all. No “Dazu steht nichts im Handbuch”, but an empty reply (exit code 52).
What also happened in the lab: After the deletion the film still physically lives in the pod:
kubectl -n rag exec qdrant-0 -c qdrant -- ls /qdrant/snapshots/wissenshowed the filewissen-3100333476874010-2026-12-02-19-30-03-5.snapshotand its.checksumfile. But through the API you can no longer reach it:GET /collections/wissen/snapshotsansweredNot found: Collectionwissendoesn't exist!. Without the copy in~/kurs/12/sicherungyou would now be standing in front of a file you cannot fetch.
Remember: A replica is not a backup. Whatever you delete in one cabinet, the house council deletes in all.
Save your progress? Sign up for free
Drill 6: From the film back into the cabinet
Where you are: on rag1, in
~/kurs/12.wissenandkartenare deleted.What you have afterwards:
wissenwith two copies,kartenwith key and index, a desk that answers again – and the measured gap.
In this drill: the archivist fetches the film from the archive and prints the cards again. Afterwards you count what is missing.
Before you restore – your prediction:
- How many points does
wissenhave after the restore: 173 or 174?- What does the desk then answer to the maintenance question from Drill 4?
Write down both answers.
Step 1 – time.
# on rag1
date -u +%TExpected:
19:31:33
Step 2 – upload the film. Qdrant accepts a snapshot
as a file upload. You send the file from the archive via standard input
into the helper pod and from there to qdrant-0. Put in
your file name from Drill 2.
# on rag1
kubectl -n rag exec -i curl -- curl -s -X POST \
'http://qdrant-0.qdrant-headless:6333/collections/wissen/snapshots/upload?priority=snapshot&wait=true' \
-F 'snapshot=@-;filename=wissen.snapshot' \
< sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot| Setting | Value | Meaning |
|---|---|---|
| URL | …/collections/wissen/snapshots/upload |
upload the file and create the collection wissen from
it; the name in the URL decides what the collection is called
afterwards |
priority |
snapshot |
the film wins. The default replica would give priority
to a still living copy in the cluster – wrong for a mistake that hit
both copies |
wait |
true |
only answer when the collection is back |
-F 'snapshot=@-;…' |
form field snapshot |
curl sends a form with a file; @- means:
file content from standard input |
filename= |
wissen.snapshot |
Qdrant stores the uploaded file under this name |
< sicherung/… |
your backup | the standard input |
Expected:
{"result":true,"status":"ok","time":1.177701978}
# on rag1
date -u +%TExpected:
19:31:35
Qdrant needed 1.2 seconds, the whole command about two.
Step 3 – what happens in the second cabinet. You
sent the film only to qdrant-0. You ask
qdrant-1 right away.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected (one second after the upload):
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 0,
"state": "Recovery"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": [
{
"shard_id": 0,
"from": 3100333476874010,
"to": 1806199031829577,
"sync": true,
"method": "wal_delta",
"comment": "downloading (0.01s) | 0 B transferred, 0 B/s"
}
]
}
| Field | Value | Meaning |
|---|---|---|
local_shards[0].state |
Recovery |
qdrant-1 has the collection again, but still empty; the
copy is being built |
remote_shards[0].state |
Active |
on qdrant-0 the shard from the film is already
complete |
shard_transfers |
from qdrant-0 to qdrant-1 |
Qdrant copies the shard into the second cabinet on its own |
What you see: You had to upload the film only once.
Because replication_factor: 2 is on the film too
(config.json), Qdrant creates the second copy itself – just
like on Day 11 with replicate_shard, only without your
command. Your peer numbers differ.
Step 4 – count and indexes. The description of the
collection, again from qdrant-1:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen > wissen.json# on rag1
jq '.result | {status, points_count, payload_schema}' wissen.jsonExpected:
{
"status": "green",
"points_count": 173,
"payload_schema": {
"quelle": {
"data_type": "keyword",
"points": 173
},
"text": {
"data_type": "text",
"params": {
"type": "text",
"tokenizer": "word",
"scoring": {
"type": "bm25"
}
},
"points": 173
}
}
}
What you see: 173 points, both payload indexes as in Drill 1. Not 174.
Step 5 – the desk answers again. Now the Secret question, this time with the output in a file.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- < f02.json > antwort.jsonRight after that the time – this is the end of the RTO measurement for the search.
# on rag1
date -u +%TExpected:
19:31:40
# on rag1
jq . antwort.jsonExpected:
{
"antwort": "[1] Ein Secret darf maximal 1 MiB in Größe betragen.",
"quellen": [
{
"nr": 1,
"quelle": "k8s-secret.md",
"abschnitt": "Size limit",
"score": 0.733
},
{
"nr": 2,
"quelle": "k8s-secret.md",
"abschnitt": "Secrets",
"score": 0.608
},
{
"nr": 3,
"quelle": "k8s-secret.md",
"abschnitt": "Secrets",
"score": 0.582
}
],
"sekunden": {
"suche": 0.31,
"gesamt": 2.38
}
}
What you see: The same answer and the same scores as on Day 11. Damage at 19:31:12, answer at 19:31:40 – the desk was without cards for 28 seconds. 21 seconds of that went into looking around in Drill 5, seven into the restore. In the lab the commands ran directly one after another; for you your reading and typing time is added. Exactly that belongs to the RTO in a real incident.
Step 6 – the second cabinet is done.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected:
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 173,
"state": "Active"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": []
}
Both copies Active, 173 cards, no transfer any more –
five seconds after the upload.
Step 7 – the maintenance question.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- \
< wartung.json > wartung-antwort.json# on rag1
jq . wartung-antwort.jsonExpected:
{
"antwort": "Das Wartungsfenster für den Kubernetes-Cluster ist nicht definiert in den angegebenen Karten. Dazu steht nichts im Handbuch.",
"quellen": [
{
"nr": 1,
"quelle": "k8s-pod-lifecycle.md",
"abschnitt": "Detection of kubelet restarts",
"score": 0.574
},
{
"nr": 2,
"quelle": "k8s-pod-lifecycle.md",
"abschnitt": "Pods and fault recovery",
"score": 0.553
},
{
"nr": 3,
"quelle": "k8s-pod-lifecycle.md",
"abschnitt": "Container probes",
"score": 0.55
}
],
"sekunden": {
"suche": 0.25,
"gesamt": 4.19
}
}
What you see: The card
nachtrag-wartung.txt is missing from the sources. The desk
only finds the three cards that were on places 2 to 4 in Drill 4 and
says correctly that the window “is not defined in the given cards –
nothing about it in the handbook”. That is the RPO as a user experiences
it: no error message, just an answer that was different yesterday.
Resolving your prediction:
- 173. The film is from 19:30:03, card 1201 from 19:30:34.
- “… Dazu steht nichts im Handbuch.” – the answer from before the addition.
Step 8 – bring the table back. In PostgreSQL the
database rag still exists, only the table is missing. So
you do not want to restore everything – the extension
vector is still there – but only karten. That
is what -t is for.
Before you run it – your prediction: After
pg_restore -t karten– are primary key and HNSW index back? Look at the table of contents from Drill 3 again.
# on rag1
kubectl -n rag exec -i pg-1 -c postgres -- \
pg_restore -d rag -t karten < sicherung/rag.dump-d rag– restore into the databaserag(without-d,pg_restorewould only print SQL),-t karten– only the tablekarten.
Without errors nothing comes back. You look at the table.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag -c "\d karten"\d karten– columns and indexes of the table.
Expected:
Table "public.karten"
Column | Type | Collation | Nullable | Default
-----------+--------------+-----------+----------+---------
id | integer | | not null |
abteilung | text | | |
text | text | | |
embedding | vector(1024) | | |
What you see: Columns yes, but no
section Indexes:. -t selects exactly the
entries TABLE and TABLE DATA in the table of
contents. CONSTRAINT karten_pkey and
INDEX karten_hnsw are separate entries – they stay behind.
Without a primary key a second row with ID 1 would now go through;
without the HNSW index pgvector scans every row one by one.
Step 9 – add the indexes. The table of contents is
split into three sections: pre-data
(extension, empty table), data (rows) and
post-data (keys, indexes). You restore the last one.
# on rag1
kubectl -n rag exec -i pg-1 -c postgres -- \
pg_restore -d rag --section=post-data < sicherung/rag.dump--section=post-data– only keys and indexes.
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag -c "\d karten"Expected:
Table "public.karten"
Column | Type | Collation | Nullable | Default
-----------+--------------+-----------+----------+---------
id | integer | | not null |
abteilung | text | | |
text | text | | |
embedding | vector(1024) | | |
Indexes:
"karten_pkey" PRIMARY KEY, btree (id)
"karten_hnsw" hnsw (embedding vector_cosine_ops)
Now the rows:
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag \
-c "SELECT id, abteilung, left(text, 40) AS anfang FROM karten ORDER BY id;"Expected:
id | abteilung | anfang
----+-----------+------------------------------------------
1 | IT | Druckdienst neu starten: Melde dich am D
2 | IT | VPN-Zugang einrichten: Lade das Profil f
3 | Personal | Urlaub beantragen: Trage den Urlaub im P
4 | IT | Backup wiederherstellen: Die Sicherungen
(4 rows)
# on rag1
date -u +%TExpected:
19:31:57
What you see: Four rows, row 5 is missing. Table
dropped at 19:31:13, completely back at 19:31:57 – 44 seconds, of which
four for the two pg_restore runs.
Resolving your prediction: No.
-tbrings table and rows, but neither primary key nor index. Only--section=post-databrings them.
Step 10 – add the missing card by hand. In the lab you are lucky: the files from Drill 4 are still there. With them you replay the lost card – the way in operations you re-apply changes from another source.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X PUT 'http://qdrant.rag:6333/collections/wissen/points?wait=true' \
-H 'Content-Type: application/json' -d @- < nachtrag-punkt.jsonExpected:
{"result":{"operation_id":29,"status":"completed"},"status":"ok","time":0.021723309}
The operation_id is 29 again – the same counter as in
Drill 4. The film also brought back the state of the write log.
# on rag1
kubectl -n rag exec -i pg-1 -c postgres -- psql -d rag < nachtrag.sqlExpected:
INSERT 0 1
And the maintenance question once more:
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- \
< wartung.json > wartung-antwort.json# on rag1
jq .antwort wartung-antwort.jsonExpected:
"[1] Das Wartungsfenster für den Kubernetes-Cluster ist jeden Dienstag von 18 bis 20 Uhr."
Remember: After a restore, do not only check “is it running?”, but count and compare: points, rows, indexes – and one question whose answer you know.
Save your progress? Sign up for free
Drill 7: The empty room
Where you are: on rag1, in
~/kurs/12.What you have afterwards: the measured time in which the film turns an empty namespace into a searchable collection and a complete database. At the end the namespace is gone again.
In this drill: the archivist rehearses the worst case. New, empty
cabinets in an empty room – only the film is there. The room is the
namespace rag-neu, the cabinets are a separate Qdrant and a
separate PostgreSQL.
Step 1 – the PostgreSQL for the empty room. You take the manifest from Day 5 and change only the namespace.
# on rag1
cp ~/kurs/05/pg.yaml pg-neu.yaml# on rag1
nano pg-neu.yamlapiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pg
namespace: rag-neu
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:18-standard-trixie
storage:
size: 2Gi
storageClass: local-path
bootstrap:
initdb:
database: rag
owner: rag
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
memory: 1Gi| Line | Setting | Meaning |
|---|---|---|
| 4 | name: pg |
the same name as in production – in its own namespace that is no
problem, the pod is again called pg-1 |
| 5 | namespace: rag-neu |
the empty room |
| 12–15 | initdb |
an empty database rag owned by rag; table
and extension come from the backup |
Step 2 – the search request for the test. To check whether the search in the empty room answers, you do not need an embedding service: Qdrant can search with the vector of an existing point. You take the printer card whose ID you know from Day 6.
# on rag1
nano suche-id.json{
"query": "d4d25b67-bc51-83dc-af11-e456c6fe226d",
"limit": 3,
"with_payload": ["quelle", "abschnitt"]
}query– a point ID instead of a vector: “cards like this one”; the card itself is not among the hits,limit– three hits,with_payload– return only these two payload fields.
The ID is the same for you if your printer card was created as on Day 6; it is calculated there from model, source and text.
Step 3 – start the clock. From now on you measure the RTO for “everything is gone”.
# on rag1
date -u +%TExpected:
19:32:42
Step 4 – the empty room.
# on rag1
kubectl create namespace rag-neuExpected:
namespace/rag-neu created
Step 5 – an empty card cabinet. The same chart as on
Day 4, with the values from Day 4: one replica, 2 GiB on
local-path.
# on rag1
helm install qdrant qdrant/qdrant --version 1.20.3 \
-n rag-neu -f ~/kurs/04/qdrant-werte.yamlqdrant– the name of the installation; in its own namespace it may have the same name,--version 1.20.3– the same version as in production; a film from 1.20.3 belongs in a Qdrant 1.20.3,-n rag-neu– into the empty room,-f ~/kurs/04/qdrant-werte.yaml– the values from Day 4 (replicaCount: 1, without anti-affinity).
Expected (excerpt):
NAME: qdrant
LAST DEPLOYED: Wed Dec 2 19:32:43 2026
NAMESPACE: rag-neu
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
Step 6 – an empty card ledger.
# on rag1
kubectl apply -f pg-neu.yamlExpected:
cluster.postgresql.cnpg.io/pg created
Step 7 – wait until both are ready. Qdrant first:
# on rag1
kubectl -n rag-neu rollout status statefulset/qdrant --timeout=300sExpected:
Waiting for 1 pods to be ready...
partitioned roll out complete: 1 new pods have been updated...
# on rag1
date -u +%TExpected:
19:32:56
Then PostgreSQL. The CloudNativePG operator reports the condition
Ready on the object cluster/pg.
# on rag1
kubectl -n rag-neu wait --for=condition=Ready cluster/pg --timeout=600sExpected:
cluster.postgresql.cnpg.io/pg condition met
# on rag1
date -u +%TExpected:
19:33:11
What you see: Qdrant was ready after 14 seconds, PostgreSQL after 29. Where the pods run, the next command shows.
# on rag1
kubectl -n rag-neu get pods -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
pg-1 1/1 Running 0 12s 10.42.1.9 rag2
qdrant-0 1/1 Running 0 29s 10.42.1.7 rag2
Both landed on rag2, where both images were already present. On rag1
the PostgreSQL image is missing (it never ran there) – had
pg-1 been scheduled there, a download would have been
added.
Step 8 – play in the films. The same upload as in
Drill 6, this time to qdrant.rag-neu. The helper pod
curl lives in the namespace rag and reaches
the other namespace via the name
<service>.<namespace>.
# on rag1
kubectl -n rag exec -i curl -- curl -s -X POST \
'http://qdrant.rag-neu:6333/collections/wissen/snapshots/upload?priority=snapshot&wait=true' \
-F 'snapshot=@-;filename=wissen.snapshot' \
< sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshotExpected:
{"result":true,"status":"ok","time":0.900914523}
# on rag1
kubectl -n rag exec -i curl -- curl -s -X POST \
'http://qdrant.rag-neu:6333/collections/handbuch/snapshots/upload?priority=snapshot&wait=true' \
-F 'snapshot=@-;filename=handbuch.snapshot' \
< sicherung/handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshotExpected:
{"result":true,"status":"ok","time":0.442904423}
Step 9 – play in the whole database. This time the
database is empty, so you need everything from the backup: extension,
table, rows, key, index. Without -t and without
--section, pg_restore restores everything.
# on rag1
kubectl -n rag-neu exec -i pg-1 -c postgres -- \
pg_restore -d rag < sicherung/rag.dump-n rag-neu– the podpg-1in the empty room, not production.
Without errors nothing comes back.
Step 10 – the first search.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://qdrant.rag-neu:6333/collections/wissen/points/query \
-H 'Content-Type: application/json' -d @- < suche-id.json > suche-neu.json# on rag1
date -u +%TExpected:
19:33:16
# on rag1
jq -c '.result.points[]' suche-neu.jsonExpected:
{"id":"add7cd1a-b09a-efe0-5a8f-ab0bd74fb3cc","version":16,"score":0.5314466,"payload":{"quelle":"karte-backup.txt","abschnitt":"Backup wiederherstellen"}}
{"id":"50b2829d-f57b-c17b-e998-a3a05341777c","version":19,"score":0.47736663,"payload":{"quelle":"karte-vpn.txt","abschnitt":"VPN-Zugang einrichten"}}
{"id":"7d9fdb89-f73a-3327-6bc4-3f1387d3fdbb","version":6,"score":0.47715932,"payload":{"quelle":"k8s-pod-lifecycle.md","abschnitt":"Pod-level container restart policy"}}
What you see: Three hits with payload – the empty room searches. Clock: 19:32:42 to 19:33:16, 34 seconds.
Step 11 – the database.
# on rag1
kubectl -n rag-neu exec pg-1 -c postgres -- psql -d rag \
-c "SELECT count(*) FROM karten;"Expected:
count
-------
4
(1 row)
# on rag1
kubectl -n rag-neu exec pg-1 -c postgres -- psql -d rag -c "\d karten"Expected (excerpt – the end):
Indexes:
"karten_pkey" PRIMARY KEY, btree (id)
"karten_hnsw" hnsw (embedding vector_cosine_ops)
Four rows, both indexes – at 19:33:17, 35 seconds after the start.
Step 12 – what the film brought along.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag-neu:6333/collections/wissen > wissen-neu.json# on rag1
jq '.result | {status, points_count, payload_schema: (.payload_schema | keys), config: .config.params}' \
wissen-neu.json(.payload_schema | keys)– only the names of the payload indexes,.config.params– the basic settings of the collection.
Expected:
{
"status": "green",
"points_count": 173,
"payload_schema": [
"quelle",
"text"
],
"config": {
"vectors": {
"size": 1024,
"distance": "Cosine"
},
"shard_number": 1,
"replication_factor": 2,
"write_consistency_factor": 1,
"on_disk_payload": true
}
}
What you see: 173 points, both indexes, 1024
dimensions, cosine. Notable: replication_factor: 2,
although only one peer runs in the empty room. The
setting came with the film; this cluster cannot fulfil it. Qdrant still
reports green. If a second peer joins later, you have to
trigger the copy yourself (Day 11).
Step 13 – clear the room again. You no longer need
the empty room after the diagnosis task. Read the diagnosis task first –
it uses rag-neu – and clean up afterwards with the two
commands here. First Helm removes its installation:
# on rag1
helm uninstall qdrant -n rag-neuExpected:
release "qdrant" uninstalled
Then the namespace with everything still in it – PostgreSQL and the volumes.
# on rag1
kubectl delete namespace rag-neuExpected (in the lab after 17 seconds):
namespace "rag-neu" deleted
The local-path volumes have the reclaim policy
Delete; with the PVCs the folders on the node disappear as
well. kubectl get pv afterwards showed only the six volumes
of the namespace rag.
Remember: A backup you have never restored into an empty room is a hope. Only the rehearsal tells you whether the film is enough – and how long it takes.
Save your progress? Sign up for free
The bill: RPO and RTO
Now you put the noted times together. The table shows the values from the lab; write yours next to them.
| Event | Qdrant wissen |
PostgreSQL karten |
|---|---|---|
| backup (film) | 19:30:03 | 19:30:15 |
| last change after the backup | 19:30:34 (point 1201) | 19:30:36 (row 5) |
| damage | 19:31:12 | 19:31:13 |
| complete again | 19:31:40 (desk answers) | 19:31:57 (rows and indexes) |
RPO – what was lost:
- Everything after 19:30:03 (Qdrant) or 19:30:15 (PostgreSQL). Concretely: one card and one row.
- The time window between backup and damage was 69 seconds (Qdrant) and 58 seconds (PostgreSQL).
- In operations the RPO is the gap between two backups: if you back up once a night, damage in the evening can cost almost a day of changes.
RTO – how long the desk was gone:
| Case | measured | of which restoring |
|---|---|---|
| collection deleted, cluster intact (Drill 6) | 28 s until the correct answer | 7 s (upload to answer) |
| table dropped (Drill 6) | 44 s until rows and indexes | 4 s (two pg_restore) |
| everything gone, empty namespace (Drill 7) | 34 s until the search, 35 s until the database | about 4 s (uploads and pg_restore) |
What stands out: with these data volumes the actual restore takes seconds. The rest is human time – recognising the situation, finding commands, copying names – and in the empty room, starting the databases. With more data the machine time grows; the human time grows if nobody has practised the steps.
Remember: The RPO depends on how often you back up; the RTO on how well you have practised the restore. You measure both with the clock, not with a feeling.
If it does not work
| Symptom | Cause | Fix |
|---|---|---|
GET …/snapshots/<name> returns
Not found |
name copied wrongly or the wrong peer asked (qdrant.rag
instead of qdrant-0.qdrant-headless) |
copy the name from snap-wissen.json, ask the same peer
as when creating it |
sha256sum differs from checksum |
the file was damaged or truncated during download | repeat the download, compare the size with size |
answer service returns nothing, curl exit 52 |
the collection is missing; Qdrant answers 404, the
answer service aborts |
restore the collection (Drill 6) |
after pg_restore -t key and index are missing |
-t selects only TABLE and
TABLE DATA |
pg_restore --section=post-data |
| snapshot list empty after the Qdrant pod restarts | snapshots live in an emptyDir (diagnosis task) |
download the snapshot right away or enable
snapshotPersistence in the chart |
replication_factor: 2 on a cluster with one peer |
the setting came with the film | leave it deliberately or create a copy later with
replicate_shard |
Diagnosis task
The situation: A colleague says: “We don’t need an archive on rag1. Qdrant has a snapshot list – I create a snapshot every evening, it stays in Qdrant.” After a restart of the Qdrant pod she wants to restore and finds no snapshot. Why?
Recreate the situation in the empty room rag-neu from
Drill 7 (before cleaning up in step 13). First she creates a snapshot of
handbuch:
# on rag1
kubectl -n rag exec curl -- curl -s -X POST \
"http://qdrant.rag-neu:6333/collections/handbuch/snapshots?wait=true" \
> snap-neu.json# on rag1
jq .result.name snap-neu.jsonExpected (the number is the peer number of the new pod, the time is yours):
"handbuch-6482674234356131-2026-12-02-19-33-36-0.snapshot"
She looks at the list:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag-neu:6333/collections/handbuch/snapshots > liste-neu.json# on rag1
jq -c '.result[] | {name, size}' liste-neu.jsonExpected:
{"name":"handbuch.snapshot","size":99328}
{"name":"handbuch-6482674234356131-2026-12-02-19-33-36-0.snapshot","size":99328}
Two entries: the one just created and handbuch.snapshot
– that is the file you uploaded in Drill 7. Uploaded films stay in the
list.
Then the pod restarts – in operations through an update or a node change, here by hand:
# on rag1
kubectl -n rag-neu delete pod qdrant-0Expected:
pod "qdrant-0" deleted from rag-neu namespace
# on rag1
kubectl -n rag-neu wait --for=condition=Ready pod/qdrant-0 --timeout=120sExpected:
pod/qdrant-0 condition met
Try it yourself first, then read on.
Solution path.
Step 1 – the list after the restart.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag-neu:6333/collections/handbuch/snapshots > liste-neu.json# on rag1
jq . liste-neu.jsonExpected:
{
"result": [],
"status": "ok",
"time": 0.000606726
}
Step 2 – the cards themselves.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag-neu:6333/collections/handbuch > handbuch-neu.json# on rag1
jq .result.points_count handbuch-neu.jsonExpected:
4
What you see: The cards are still there, the films are not.
Step 3 – why.
# on rag1
kubectl -n rag-neu describe pod qdrant-0Expected (excerpt – the mounts of the container
qdrant and part of the section Volumes):
Mounts:
/qdrant/config/initialize.sh from qdrant-config (rw,path="initialize.sh")
/qdrant/config/production.yaml from qdrant-config (rw,path="production.yaml")
/qdrant/init from qdrant-init (rw)
/qdrant/snapshots from qdrant-snapshots (rw)
/qdrant/storage from qdrant-storage (rw)
…
qdrant-snapshots:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
The cause: /qdrant/snapshots comes from
the volume qdrant-snapshots, and that is – as in Drill 1
for production – an EmptyDir. It is created with the pod
and deleted with it. The cards, in contrast, live on the
PersistentVolume under /qdrant/storage and survive.
Step 4 – what the colleague should have done. Two ways that complement each other:
- Fetch every snapshot out of the pod right away and compare the checksum (Drill 2).
- Set
snapshotPersistence.enabled: truein the chart. Then every Qdrant pod gets its own PersistentVolume for snapshots. That protects against the restart – but not against losing the node, because alocal-pathvolume lives on exactly that node (Day 11).
Afterwards you clean up rag-neu (Drill 7, step 13).
Challenge
A user reports: “Yesterday the handbook said something different.”
You want to put the film next to production and
compare, without touching wissen. Restore the snapshot as
collection wissen-gestern, find out whether point 1201 is
in it, and clean up afterwards.
The author’s solution. The name in the upload URL determines the name of the collection.
# on rag1
kubectl -n rag exec -i curl -- curl -s -X POST \
'http://qdrant-0.qdrant-headless:6333/collections/wissen-gestern/snapshots/upload?priority=snapshot&wait=true' \
-F 'snapshot=@-;filename=wissen-gestern.snapshot' \
< sicherung/wissen-3100333476874010-2026-12-02-19-30-03-5.snapshotExpected:
{"result":true,"status":"ok","time":1.272370186}
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/wissen-gestern > gestern.json# on rag1
jq .result.points_count gestern.jsonExpected:
173
Since Drill 6, step 10, production has 174 again. Whether point 1201 is on the film, you ask directly:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/wissen-gestern/points/1201Expected:
{"status":{"error":"Not found: Point with id 1201 does not exists!"},"time":0.001055588}
The difference is exactly the card about the maintenance window. Now you delete the comparison collection again.
# on rag1
kubectl -n rag exec curl -- \
curl -s -X DELETE http://qdrant.rag:6333/collections/wissen-gesternExpected:
{"result":true,"status":"ok","time":0.165833383}
What also happened in the lab: Films stay in the pod in production too. After Drill 6 and the challenge,
GET …/collections/wissen/snapshotsonqdrant-0showed two entries (wissen.snapshotfrom the upload and the film from Drill 2), together 6.4 MB in/qdrant/snapshots. The author deleted them withDELETE …/collections/<name>/snapshots/<file>?wait=true(answer{"result":true,…}) – that only works as long as the collection exists. The filewissen-gestern.snapshottherefore stayed behind (2.2 MB); it disappears with theemptyDirat the next restart ofqdrant-0.
Save your progress? Sign up for free
Checkpoint
The empty room is gone:
# on rag1
kubectl get namespace rag-neuExpected:
Error from server (NotFound): namespaces "rag-neu" not found
The archive is there:
# on rag1
ls -l sicherungExpected:
total 2264
-rw-rw-r-- 1 ubuntu ubuntu 99328 Dec 2 19:30 handbuch-3100333476874010-2026-12-02-19-30-04-6.snapshot
-rw-rw-r-- 1 ubuntu ubuntu 24087 Dec 2 19:30 rag.dump
-rw-rw-r-- 1 ubuntu ubuntu 2189824 Dec 2 19:30 wissen-3100333476874010-2026-12-02-19-30-03-5.snapshot
wissen has two active copies with 174 cards each:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected:
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 174,
"state": "Active"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": []
}
handbuch is untouched:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/handbuch > handbuch.json# on rag1
jq .result.points_count handbuch.jsonExpected:
4
PostgreSQL has five rows and both indexes:
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag \
-c "SELECT count(*) FROM karten;"Expected:
count
-------
5
(1 row)
# on rag1
kubectl -n rag exec pg-1 -c postgres -- psql -d rag -c "\d karten"Expected (excerpt – the end):
Indexes:
"karten_pkey" PRIMARY KEY, btree (id)
"karten_hnsw" hnsw (embedding vector_cosine_ops)
The desk knows the maintenance window:
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H 'Content-Type: application/json' -d @- \
< wartung.json > wartung-antwort.json# on rag1
jq .antwort wartung-antwort.jsonExpected:
"[1] Das Wartungsfenster für den Kubernetes-Cluster ist jeden Dienstag von 18 bis 20 Uhr."
Empty room cleared, three files in the archive, wissen
with 174 cards on both peers, karten with five rows and
indexes, the desk answers.
Test yourself
wissenhas two copies on two nodes. Why do you still need a backup?- How do you recognise that a downloaded snapshot file is complete and unchanged?
- You create a snapshot every evening at 10 pm, and the next day at 5 pm somebody deletes the collection. How large is the data loss in the worst case, and how do you see it in the answer service?
- After
pg_restore -t karten, searches in pgvector are noticeably slow. What happened, and how do you fix it? - Why is a snapshot list in Qdrant on its own not a backup?
- What do you measure in a restore test into a fresh environment that you do not see in a restore into production?
Answers:
- A replica repeats every change – deletion included. After a single
DELETEonwissenthe collection was gone on both peers one second later. Only a copy taken at a point in time and not changed afterwards brings back the old state. - Your own SHA-256 checksum (
sha256sum) must match the fieldchecksumQdrant returned when creating it. Same size alone is not enough. - Everything since 10 pm – 19 hours of changes. In the answer service you do not see it as an error but as an outdated answer: new cards are missing from the sources, questions about them end with “Dazu steht nichts im Handbuch.” (Drill 6, step 7).
-trestored only table and rows; primary key and HNSW index are separate entries in the table of contents and are missing.\d kartenshows no sectionIndexes:. Fix:pg_restore -d rag --section=post-data.- With the chart’s default the snapshots live in an
emptyDir– they disappear when the pod restarts (diagnosis task). And they live on the same node as the data. A backup has to leave the pod. - The time needed to start the databases at all (in the lab 14 s for
Qdrant, 29 s for PostgreSQL), images missing on the node, and whether
the film works without production – for example that the extension
vectorcomes along and thatreplication_factor: 2sits on a single peer.
Interview note
“How do you back up a RAG pipeline?” – I back up each store with its
own tool: Qdrant collections as snapshots via the API, PostgreSQL with
pg_dump or, with CloudNativePG, with continuous WAL
archiving. The files leave the cluster right away and are checked by
checksum. Replication does not replace this: a deleted collection is
deleted on all peers. The most important part is the restore test into
an empty environment with the clock in hand. In the lab: 173 cards and a
database searchable in 34 seconds, restore into production in 28 seconds
to the correct answer, and exactly what was written after the snapshot
was lost. Alternatively the vector store can be re-indexed from the
source documents – that took about four minutes here and costs embedding
compute, but it is a second, independent way back.
Enterprise note
In operations the backup runs on a schedule, not by hand: a CronJob
that creates snapshots, downloads them, compares the checksum and writes
them to an object store outside the cluster. Qdrant can also write
snapshots directly to an S3-compatible store (setting
storage.snapshots_config). With CloudNativePG, continuous
backup via the Barman Cloud plugin replaces pg_dump: base
backup plus WAL archive in an object store. That lowers the RPO for
PostgreSQL from “since the last backup” to a few minutes and makes
recovery to a specific point in time (point-in-time recovery) possible –
in the lab archive_mode: "on" is already in the cluster
configuration, only a destination is missing. Backups are encrypted,
kept with limited retention and held in at least a second location. The
restore test into a fresh environment is a fixed appointment with a
record – RPO and RTO are in the operations handbook as measured values,
not as wishes.
Summary
- Backed up are
wissenandhandbuch(Qdrant) and the databaserag(PostgreSQL); measurement series can be recreated. - A snapshot is created on the peer you ask and lives
in an
emptyDir– only after downloading it and comparing the checksum is it a backup. pg_dump -Fcbacks up the database;pg_restore --listshows extension, table, data, key and index as separate entries.- One
DELETEremovedwissenon both peers. The answer service then returned an empty reply (exit 52). - An upload to one peer restored
wissen; Qdrant created the second copy itself. The desk answered again 28 seconds after the damage, the restore itself took 7 seconds. pg_restore -tbrought the table back without key and index;--section=post-dataadded them.- RPO: everything after the film was missing – one card, one row. The desk again said “Dazu steht nichts im Handbuch”.
- The fresh environment was searchable after 34
seconds; the film brought indexes and
replication_factor: 2along.
Commands at a glance
| Command | what it does | important options |
|---|---|---|
kubectl -n <ns> describe pod <pod> |
volumes of a pod, e.g. EmptyDir for snapshots |
– |
curl -X POST '…/collections/<name>/snapshots?wait=true' |
create a snapshot of a collection on the peer asked | wait=true |
curl …/collections/<name>/snapshots |
list the snapshots of a peer | – |
curl …/collections/<name>/snapshots/<file> > <file> |
download a snapshot | headless name of the peer |
sha256sum <file> |
calculate the checksum | – |
tar -tvf <file> |
list the content of an archive | – |
pg_dump -Fc -d <db> |
back up a database | -Fc for pg_restore |
pg_restore --list |
table of contents of a backup | – |
pg_restore -d <db> -t <table> |
restore only table and rows | without keys and indexes |
pg_restore -d <db> --section=post-data |
restore only keys and indexes | pre-data, data,
post-data |
curl -X POST '…/snapshots/upload?priority=snapshot&wait=true' -F 'snapshot=@-;filename=…' |
upload a snapshot and create the collection | priority, name in the URL |
curl -X DELETE '…/collections/<name>/snapshots/<file>?wait=true' |
delete a snapshot in the pod | – |
kubectl -n <ns> wait --for=condition=Ready cluster/<name> |
wait until CloudNativePG reports the database | --timeout= |
helm uninstall <release> -n <ns> ·
kubectl delete namespace <ns> |
remove the rehearsal environment | – |
date -u +%T |
note the time for RPO/RTO | – |