Back to articles
AI & Cloud

Build a Highly Fault-Tolerant Distributed Storage System for Small VPS Clusters with Garage S3

A technical guide to building a highly fault-tolerant distributed storage system for small VPS clusters using Garage S3, optimizing performance, reliability, and cost for AI, API,...

DPTCloud Engineering4 min read
Build a Highly Fault-Tolerant Distributed Storage System for Small VPS Clusters with Garage S3

Introduction

In an era of increasing demand for distributed data storage, automated backups, and high fault tolerance, building a highly fault-tolerant distributed storage system for small VPS clusters is essential. With Garage S3—a distributed storage platform open-source and compatible with the S3 protocol—we can deploy an effective, low-cost, and easily scalable solution for AI applications, APIs, and data storage.

This guide walks through building a highly fault-tolerant distributed storage system for small VPS clusters using Garage S3. The system ensures data is distributed across multiple nodes, enables automatic recovery in case of failures, and remains stable even when some nodes lose connectivity.

Requirements and Prerequisites

To deploy this system, you need:

  • A small VPS cluster (at least 3 nodes) running Linux (Ubuntu 22.04 or Debian 11).
  • Ensure all VPS nodes can communicate over the network (same internal network or public internet).
  • Required software: Docker, Docker Compose, Git.
  • Optional tools: curl, wget, SSH, and a configuration manager like Ansible.

Deploying Garage S3

Garage S3 can be deployed easily using Docker. Below is a basic configuration to initialize a Garage S3 node:

docker run -d \
  --name garage-s3 \
  --restart=unless-stopped \
  -p 8080:8080 \
  -v /path/to/data:/data \
  garageproject/garage:latest

For a multi-node cluster, configure garage.yml to define the nodes in the cluster. Example:

garage:
  # Node ID
  id: node-1
  # Node IP or hostname
  address: 192.168.1.101:8080
  # List of other nodes in the cluster
  peers:
    - 192.168.1.102:8080
    - 192.168.1.103:8080
  # Data storage directory
  data_dir: /data

Run the following command on each node to start Garage S3 with the configuration:

docker run -d \
  --name garage-s3 \
  --restart=unless-stopped \
  -p 8080:8080 \
  -v /path/to/data:/data \
  -v /path/to/garage.yml:/garage.yml \
  -e GARAGE_CONFIG=/garage.yml \
  garageproject/garage:latest

Testing and Performance Optimization

After deployment, verify system functionality by:

  1. Checking connectivity between nodes:
  2. curl http://192.168.1.101:8080/health
  3. Uploading and downloading data to test performance:
  4. aws s3 cp testfile.txt s3://my-bucket/testfile.txt --endpoint-url http://192.168.1.101:8080
  5. Optimizing performance by adjusting configuration:
    • Reduce connection timeout values.
    • Adjust the number of processing threads.
    • Set up cache for frequently accessed data.

Maintenance and Fault Handling

To ensure system stability, implement the following measures:

  • Use monitoring tools like Prometheus and Grafana for continuous monitoring.
  • Set up alerts for node failures or lack of response.
  • Regularly back up configuration and data.
  • Test failover scenarios to ensure availability.

In the event of a node failure, Garage S3 automatically redirects requests to remaining nodes, ensuring data remains accessible.

References

Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways

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