Back to articles
Technology Insight

Building a High-Availability Storage System for Web Clusters Using JuiceFS and TiKV on VPS

May 30, 2026

Introduction to Modern Web Cluster Storage Challenges

In the era of cloud computing and high-traffic web applications, architectural redundancy is no longer a luxury—it is a baseline requirement. When scaling a web application horizontally across multiple Virtual Private Servers (VPS), a critical bottleneck invariably emerges: shared storage. Standard web clusters require a centralized file system where media uploads, configuration files, and application state can be accessed simultaneously by multiple application nodes.

Traditional solutions like Network File System (NFS) introduce a glaring Single Point of Failure (SPOF). If the NFS server goes down, the entire web cluster halts. While distributed file systems like Ceph offer robust high availability, they are notoriously resource-intensive and complex to manage, especially on constrained VPS environments. This is where the powerful combination of JuiceFS and TiKV changes the paradigm, offering a lightweight, POSIX-compliant, high-availability storage system tailored for modern web clusters.

Understanding the Architecture: JuiceFS and TiKV

To build an efficient storage system, we must separate the data path from the metadata path. JuiceFS achieves exceptional performance by utilizing this exact architecture:

  • JuiceFS (The File System Engine): An open-source, POSIX-compliant distributed file system. It stores file data chunks in an object storage backend (or local blocks) while storing file metadata (directory trees, file sizes, permissions) in a high-performance database.
  • TiKV (The Metadata Engine): A transactional, distributed Key-Value database graduated by the Cloud Native Computing Foundation (CNCF). TiKV provides massive scalability and strong consistency (via the Raft consensus algorithm), making it the perfect metadata engine to guarantee JuiceFS high availability.

By deploying TiKV across a cluster of VPS instances, we ensure that metadata is replicated and always available. JuiceFS then mounts this backend transparently on your web nodes, behaving exactly like a local directory while delivering distributed resilience.

Prerequisites and Environment Setup

Before proceeding with the deployment, ensure you have the following infrastructure ready:

  1. VPS Nodes: At least three standard VPS instances (Ubuntu 22.04 LTS recommended) located in the same data center or region to ensure low network latency. Three nodes are required to satisfy the Raft quorum for TiKV.
  2. Network: Private networking enabled between all VPS instances with static internal IP addresses.
  3. Resources: Minimum 2 vCPUs and 4GB RAM per node for a production-ready TiKV deployment.
Note: Low network latency between your VPS nodes is critical. Because every file system metadata operation (like listing directories or opening files) queries the TiKV cluster, a high-latency network will severely degrade storage performance.

Step-by-Step Deployment Guide

Step 1: Deploying the Distributed TiKV Cluster

The most efficient way to deploy TiKV on production VPS instances is by using TiUP, the official package and cluster manager. Log into your primary deployment node and install TiUP:

curl --proto '=https' --tlsv1.2 -sSf [https://tiup-mirrors.pingcap.com/install.sh](https://tiup-mirrors.pingcap.com/install.sh) | sh

After sourcing your profile, create a topology configuration file named topology.yaml. This file defines the layout of your PD (Placement Driver) nodes and TiKV storage nodes across your three VPS instances:global: user: "tiflash" ssh_port: 22 deploy_dir: "/tidb-deploy" data_dir: "/tidb-data" pd_servers: - host: 10.0.0.1 - host: 10.0.0.2 - host: 10.0.0.3 tikv_servers: - host: 10.0.0.1 - host: 10.0.0.2 - host: 10.0.0.3

Deploy and start the cluster using the following TiUP commands:

tiup cluster deploy tikv-storage v7.1.0 ./topology.yaml --user root -p
tiup cluster start tikv-storage

Step 2: Installing JuiceFS on Web Application Nodes

Once your TiKV cluster is healthy and status check returns green, install the JuiceFS client on all web application nodes that require access to the shared storage:

curl -sSL [https://juicefs.com/static/juicefs-check_installation](https://juicefs.com/static/juicefs-check_installation) | sh
sudo install juicefs /usr/local/bin

Step 3: Formatting and Creating the JuiceFS Volume

With JuiceFS installed and TiKV acting as our metadata engine, we can now format our new distributed file system. In this architecture, file chunks will be stored on local block storage, while TiKV manages the file structure. Run the format command from any node:

juicefs format --storage file --bucket /mnt/storage/juicefs-chunks tikv://10.0.0.1:2379,10.0.0.2:2379,10.0.0.3:2379/web-cluster-storage

In this command, we point JuiceFS to our PD cluster addresses (port 2379) and define a unique namespace for our storage volume.

Step 4: Mounting JuiceFS on the Web Cluster

On every web server node running Nginx or Apache, create a target directory and mount the JuiceFS volume:

sudo mkdir -p /var/www/shared
sudo juicefs mount tikv://10.0.0.1:2379,10.0.0.2:2379,10.0.0.3:2379/web-cluster-storage /var/www/shared --background

To ensure the file system mounts automatically upon server reboots, add the following entry to your /etc/fstab file:

tikv://10.0.0.1:2379,10.0.0.2:2379,10.0.0.3:2379/web-cluster-storage /var/www/shared juicefs _netdev,background 0 0

Performance Tuning and Optimization

To maximize the throughput of your JuiceFS-TiKV storage system within a VPS environment, several optimizations should be applied:

  • Metadata Caching: Increase the metadata cache timeout using the --attr-cache and --entry-cache flags during the mount process. This significantly reduces repetitive network round-trips to TiKV for static web assets.
  • Connection Pooling: Optimize TiKV thread pools based on your VPS CPU core count to prevent CPU throttling during high concurrent web traffic requests.
  • Local Block Prefetching: Use the --prefetch flag on your web nodes to accelerate sequential read operations for media files and large scripts.

Conclusion

Building a High-Availability storage system no longer requires locking yourself into expensive cloud provider ecosystems or wrestling with hyper-complex storage fabrics. By combining the enterprise-grade transactional consistency of TiKV with the elegant simplicity and POSIX-compliance of JuiceFS, you can turn cost-effective VPS instances into a resilient, high-performance web cluster storage backend. Implement this architecture today to eliminate your storage single point of failure and scale your web applications with confidence.

Building a High-Availability Storage System for Web Clusters Using JuiceFS and TiKV on VPS | DPTCloud