Qdrant Backup and Recovery on RHEL 9 for RAG Hosts

What this tutorial does
Qdrant is the vector database behind many RAG systems, where speed and consistency matter. If you run a chatbot, retrieval layer, or agent workflow on a Hostperl VPS or dedicated server, a bad deploy, disk failure, or accidental delete can break answers fast. This tutorial shows you how to set up Qdrant backup and recovery on RHEL 9, schedule snapshots, protect the backup directory, test a restore, and confirm the service comes back cleanly.
This guide uses RHEL 9 because Qdrant runs well in containers on SELinux-enabled systems, and the same layout works on Oracle Linux 9 and other compatible RHEL-based hosts. If you are planning the platform for a production retrieval stack, a Hostperl VPS gives you a controlled place to test snapshots before you move a live bot. For larger vector workloads, you can also pair this with dedicated server hosting.
Topology and recovery plan
The safest setup is straightforward: run Qdrant in Docker, keep data in a persistent volume under /opt/myapp/qdrant-data, and store backups outside that directory under /opt/myapp/qdrant-backups. If the container disappears, you recreate it from the image. If the data volume is damaged, you restore the latest snapshot. If the host fails, you copy the backup directory to a replacement server and start over.
We will build four things:
- a non-root admin account named
deploy - a Qdrant container with persistent storage
- a backup job that creates timestamped snapshots
- a restore test so you know the backups actually work
1) Connect to the server and identify the OS
On your local computer, connect to the VPS with the example IP below. 203.0.113.10 is a reserved documentation address, so replace it with the real public IP assigned to your server.
ssh root@203.0.113.10If your provider uses a default non-root login, use that account instead, for example:
ssh deploy@203.0.113.10After login, check the operating system so you use the right package and firewall commands.
On the VPS as root:
cat /etc/os-releaseYou should see RHEL 9, AlmaLinux 9, Rocky Linux 9, or Oracle Linux 9 details. If you are not on a RHEL-compatible host, stop here and use a matching guide instead.
2) Create a non-root admin and keep root open
Keep the original root session open until the new login is confirmed. That avoids lockout if SSH key permissions or sudo access are wrong.
On the VPS as root, create the deploy account and grant wheel access:
useradd -m -s /bin/bash deploy
passwd deploy
usermod -aG wheel deploySet a password now so you can test fallback login if needed. You can lock it later after key-based access works.
Create the SSH directory, copy your public key, and set permissions:
mkdir -p /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
cat > /home/deploy/.ssh/authorized_keys <<'EOF'
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFakeExampleKeyReplaceWithYourRealPublicKey deploy@example.com
EOF
chmod 600 /home/deploy/.ssh/authorized_keys
chown -R deploy:deploy /home/deploy/.sshReplace the sample key with your real public key. Then open a second terminal and test the new login.
On your local computer:
ssh deploy@203.0.113.10After you log in, confirm sudo works:
sudo -v
whoami
idYou should see deploy and wheel membership. Only after this test should you consider disabling root password login later.
3) Update packages and prepare Docker on RHEL 9
Qdrant is easiest to run as a container, which keeps the host clean and makes recovery predictable. Install Docker Engine from the official repository, then enable it at boot.
On the VPS as the non-root sudo user:
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
docker --version
docker compose versionThose commands add the repository, install Docker, start the daemon, and show version output. If the service does not start, check the journal:
sudo systemctl status docker --no-pager
sudo journalctl -u docker -n 50 --no-pagerOn SELinux-enabled systems, Docker usually works with the default context when volumes are mounted correctly. We will keep Qdrant data under a dedicated path and label it cleanly in the next step.
4) Create the Qdrant data and backup paths
Use a dedicated directory so the live database files and backups stay separate. That separation makes restores safer and reduces the risk of overwriting active data.
On the VPS as the non-root sudo user:
sudo mkdir -p /opt/myapp/qdrant-data /opt/myapp/qdrant-backups /opt/myapp/qdrant-config
sudo chown -R deploy:deploy /opt/myapp
sudo chmod 750 /opt/myapp /opt/myapp/qdrant-data /opt/myapp/qdrant-backups /opt/myapp/qdrant-config
pwdIf SELinux blocks writes later, inspect the audit logs instead of disabling enforcement. That keeps the host aligned with RHEL best practice.
5) Start Qdrant with Docker Compose
Create a Compose file that mounts persistent storage and keeps the service on the private loopback interface unless you truly need public API access. For most RAG systems, an internal reverse proxy or application network is enough.
On the VPS as the non-root sudo user, create the file:
cd /opt/myapp
cat > docker-compose.yml <<'EOF'
services:
qdrant:
image: qdrant/qdrant:v1.13.4
container_name: qdrant
restart: unless-stopped
ports:
- "127.0.0.1:6333:6333"
- "127.0.0.1:6334:6334"
volumes:
- /opt/myapp/qdrant-data:/qdrant/storage:Z
EOFThe :Z suffix tells SELinux to relabel the bind mount for the container. Save the file, then start the service:
sudo docker compose up -d
sudo docker ps
sudo ss -tulpn | grep 6333You should see Qdrant running and listening only on 127.0.0.1. That is safer than exposing the port to the internet.
Run a quick health check:
curl -s http://127.0.0.1:6333/healthz
A healthy response should return a simple success body. If the container fails, check the logs:
sudo docker logs --tail 100 qdrant6) Open only the SSH and local app ports you need
Because Qdrant is bound to localhost, you usually do not need to open port 6333 on the firewall. That keeps the database private and reachable only through the local app stack or a trusted proxy.
Still, verify firewalld is active and SSH remains permitted.
On the VPS as the non-root sudo user:
sudo systemctl enable --now firewalld
sudo firewall-cmd --state
sudo firewall-cmd --list-allIf you later expose Qdrant through a controlled reverse proxy, add the proxy port first, test it, then remove any older temporary rule. That sequence avoids lockouts.
7) Create a snapshot script for Qdrant backup and recovery
Qdrant stores its own data files, so a practical backup is a filesystem snapshot of the live storage directory taken after a brief container pause. For a small to medium RAG setup, that method is easy to automate and quick to restore.
Create a script that pauses the container, copies the data directory, and writes a timestamped archive.
On the VPS as the non-root sudo user:
cat > /opt/myapp/qdrant-config/qdrant-backup.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
BACKUP_DIR=/opt/myapp/qdrant-backups
DATA_DIR=/opt/myapp/qdrant-data
STAMP=$(date +%F-%H%M%S)
ARCHIVE="$BACKUP_DIR/qdrant-$STAMP.tar.gz"
TMPDIR=$(mktemp -d)
sudo docker pause qdrant
sudo rsync -a --delete "$DATA_DIR/" "$TMPDIR/"
sudo docker unpause qdrant
sudo tar -C "$TMPDIR" -czf "$ARCHIVE" .
rm -rf "$TMPDIR"
echo "$ARCHIVE"
EOF
chmod 750 /opt/myapp/qdrant-config/qdrant-backup.shThis script assumes Docker is already running and that you have sudo rights without a password prompt. If your sudo policy prompts for a password, that is fine.
Run the script manually once:
/opt/myapp/qdrant-config/qdrant-backup.sh
ls -lh /opt/myapp/qdrant-backupsYou should see a timestamped archive in the backup directory.
8) Schedule the backup with cron
Daily backups are enough for many RAG hosts, but heavier ingest pipelines may need a shorter interval. Start with one daily snapshot, then increase frequency if your index changes often.
On the VPS as the non-root sudo user:
crontab -eAdd this line, save the file, and exit the editor:
15 2 * * * /opt/myapp/qdrant-config/qdrant-backup.sh >> /opt/myapp/qdrant-backups/backup.log 2>&1This runs every day at 02:15. Check the log after the next run:
tail -n 20 /opt/myapp/qdrant-backups/backup.logIf cron never runs, verify the service:
sudo systemctl status crond --no-pager
sudo journalctl -u crond -n 50 --no-pager9) Test a restore before you need one
Backups only matter if they restore cleanly. This test uses the latest archive and loads Qdrant data into a temporary location first, so you can inspect it before replacing the live files.
On the VPS as the non-root sudo user:
LATEST=$(ls -1t /opt/myapp/qdrant-backups/qdrant-*.tar.gz | head -n 1)
mkdir -p /tmp/qdrant-restore-test
sudo tar -C /tmp/qdrant-restore-test -xzf "$LATEST"
ls -lah /tmp/qdrant-restore-testYou should see Qdrant storage files in the test directory. If the archive is empty or corrupt, the restore test will fail immediately, which is exactly why you run it.
For a full live restore, stop the container, move the current data out of the way, and replace it with the backup contents:
sudo docker stop qdrant
sudo mv /opt/myapp/qdrant-data /opt/myapp/qdrant-data.broken.$(date +%F-%H%M%S)
sudo mkdir -p /opt/myapp/qdrant-data
sudo tar -C /opt/myapp/qdrant-data -xzf "$LATEST"
sudo docker start qdrant
sudo docker logs --tail 50 qdrantIf Qdrant starts and the logs show normal startup, the restore worked. Keep the old directory until you are satisfied the service is healthy.
10) Lock down SSH after the new path is proven
Now that the deploy login works, you can harden SSH. Do not remove root access before confirming you have a working non-root path and a console recovery option.
On the VPS as root, create a drop-in file for SSH hardening:
cat > /etc/ssh/sshd_config.d/99-hardening.conf <<'EOF'
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
EOF
sshd -t
systemctl reload sshdThe syntax check must pass before reload. If sshd -t returns no output, the configuration is valid. Then test a fresh SSH login from your local computer before closing the old session.
Verification from server and client
Use both server-side and client-side checks so you confirm the container, backup path, and exposed port state.
On the VPS as the non-root sudo user:
sudo docker ps
sudo systemctl status docker --no-pager
sudo ss -tulpn | grep -E '6333|6334'
ls -lh /opt/myapp/qdrant-backupsOn your local computer:
ssh deploy@203.0.113.10
curl -s http://203.0.113.10:6333/healthzBecause Qdrant is bound to localhost in this setup, the remote curl only works if you later add a proxy or expose the port intentionally. If you keep the private pattern, test health locally on the server instead.
Common failures and how to diagnose them
Container will not start
Run:
sudo docker logs --tail 100 qdrantLook for permission errors, missing storage paths, or an invalid mount. Fix ownership with sudo chown -R deploy:deploy /opt/myapp/qdrant-data and make sure the :Z mount label is present.
SELinux denies file access
Run:
sudo ausearch -m avc -ts recent | tail -n 20If you see AVC denials tied to the Qdrant path, relabel the mount and restart the container. Do not disable SELinux to get past a temporary error.
Backup archive is empty or missing
Run:
ls -lh /opt/myapp/qdrant-backups
cat /opt/myapp/qdrant-backups/backup.logCheck cron output, disk space, and whether the pause command succeeded. If disk space is low, remove old archives after copying them off the host.
SSH hardening blocks login
Before closing your root session, keep a second terminal open and confirm you can log in with keys. If you lock yourself out, use the Hostperl console or recovery access, then revert the drop-in file from the console.
Rollback and recovery path
If a new Qdrant version misbehaves, roll back by stopping the container and restoring the previous image tag in docker-compose.yml. Then run sudo docker compose up -d again. If the data itself is bad, restore the latest snapshot into /opt/myapp/qdrant-data and restart the container. If the host is unrecoverable, copy the backup directory to a replacement Hostperl server and bring the same Compose file online there.
For customers running larger retrieval systems, that recovery path is one reason a managed VPS hosting plan or a stronger dedicated server is often easier to support than a small general-purpose instance. If you need more disk I/O or more predictable restore time, unmanaged dedicated server plans give you room for bigger indexes and longer retention.
If you are running a chatbot, RAG service, or internal retrieval stack, Hostperl can help you size the host, protect the data path, and keep recovery simple. For smaller deployments, a Hostperl VPS is enough for testing; for larger indexes and faster restore windows, consider dedicated server hosting.
Our support teams work with real migrations and launch deadlines, so you are not left guessing when a backup job, SELinux rule, or restore test fails.
FAQ
How often should I back up Qdrant?
Daily works for many RAG hosts. If you ingest documents all day, run backups every few hours and keep a longer retention policy.
Can I restore Qdrant to a different server?
Yes. Install Docker, recreate the same volume path, copy the archive to the new host, and extract it into the data directory before starting the container.
Should I expose Qdrant directly to the internet?
Usually no. Keep it on localhost and let your app or reverse proxy handle access control.
What is the main mistake to avoid?
Skipping restore tests. A backup that was never restored is only a guess, not a recovery plan.
