Back to articles
AI & Cloud

Guide to Deploy Decentralized Vector Storage Sync on 3 VPS for RAG Data Synchronization Against Data Loss

Step-by-step guide to deploy a decentralized vector storage sync system on a cluster of 3 VPS to synchronize RAG data, ensuring data integrity and high recovery capability.

DPTCloud Engineering4 min read
Guide to Deploy Decentralized Vector Storage Sync on 3 VPS for RAG Data Synchronization Against Data Loss

Image credit: Pexels · Pixabay Content License

Introduction to Decentralized Vector Storage

In modern artificial intelligence applications, especially Retrieval-Augmented Generation (RAG) systems, vector data storage and retrieval are critical components. However, centralized storage systems are vulnerable to data loss or system failures. To address this, decentralized vector storage has emerged as a popular solution, enabling data distribution and synchronization across multiple servers.

This guide walks through deploying a decentralized vector storage sync system on a cluster of 3 VPS. The goal is to ensure RAG data remains synchronized, highly recoverable, and resilient against data loss due to hardware or network failures.

Requirements and Setup

System Requirements

  • 3 VPS servers (minimum 4GB RAM, 2 vCPU, 50GB SSD)
  • Secure internal network or VPN connection between nodes
  • Linux OS installed (Ubuntu 22.04 or Debian 11)
  • SSH access with root privileges

Required Software

  • Redis or etcd for state synchronization
  • MinIO or FastAPI for vector and metadata storage
  • VectorDB (e.g., Qdrant, Weaviate, or Chroma)
  • rsync or syncthing for data synchronization
  • docker and docker-compose (optional)

Deployment Steps

Step 1: Install and Configure VectorDB

We use Qdrant as the vector database. Install it on each VPS:

curl -sSL https://raw.githubusercontent.com/qdrant/qdrant/master/docker-compose.yml -o docker-compose.yml
docker-compose up -d

After startup, Qdrant runs on port 6333. Verify the status:

curl http://localhost:6333/health

Step 2: Configure Data Synchronization Between VPS Nodes

Use rsync to synchronize the vector data directory. Create a shared directory:

mkdir -p /data/vectors

On VPS 1 (master), create a synchronization script:

#!/bin/bash
rsync -avz /data/vectors/ user@vps2:/data/vectors/
rsync -avz /data/vectors/ user@vps3:/data/vectors/

Run this script periodically using crontab:

0 * * * * /path/to/sync_script.sh

Step 3: Set Up State Synchronization Mechanism

Use Redis to track synchronization status. Install Redis on all VPS nodes:

sudo apt update
sudo apt install redis-server -y

Modify the Redis configuration file /etc/redis/redis.conf:

bind 0.0.0.0
port 6379
requirepass yourpassword

Enable and start the Redis service:

sudo systemctl enable redis-server
sudo systemctl start redis-server

Verification and Testing

Run Synchronization Test

Insert a vector into VPS 1:

curl -X POST "http://vps1:6333/collections/my_collection/vectors" \
  -H "Content-Type: application/json" \
  -d '{
    "points": [
      {
        "id": 1,
        "vector": [0.1, 0.2, 0.3],
        "payload": {"text": "test"}
      }
    ]
  }'

Verify the vector is synchronized to VPS 2 and VPS 3:

curl http://vps2:6333/collections/my_collection/vectors/1
curl http://vps3:6333/collections/my_collection/vectors/1

Failover Test

Disconnect VPS 1 and attempt to query the vector from VPS 2 and VPS 3. If the system works correctly, data should still be accessible from the remaining nodes.

Troubleshooting

  • Data not syncing: Check network connectivity, rsync permissions, and Redis service status.
  • Qdrant fails to start: Review logs at /var/log/qdrant.log.
  • Redis connection issues: Verify configuration and firewall rules.

References

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478