Cloud-Native Storage Guide

    Deploying JuiceFS on RamNode VPS

    JuiceFS is a high-performance, POSIX-compliant distributed file system designed for cloud environments. It separates data and metadata storage, allowing for flexible, scalable deployments on RamNode VPS infrastructure.

    Ubuntu 18.04+
    JuiceFS Latest
    ⏱️ 20-30 minutes

    Why JuiceFS on RamNode VPS?

    JuiceFS provides cloud-native distributed storage with unique advantages:

    High Performance

    Advanced caching and POSIX compliance for seamless application integration

    Cost-Effective Scaling

    Leverage object storage backends for economical storage growth

    Built-in Security

    Encryption and compression included out of the box

    Multi-Platform

    Support for Linux, macOS, and Windows environments

    Prerequisites & System Requirements

    Before starting, ensure you have:

    Hardware Requirements

    • • Minimum 1GB RAM (2GB+ recommended)
    • • 10GB+ available disk space
    • • RamNode VPS with root access

    Software Requirements

    • • Object storage (S3-compatible or local)
    • • Metadata engine (Redis, MySQL, PostgreSQL, or SQLite)
    • • Basic Linux administration knowledge

    Operating System Support

    • • Ubuntu 18.04+ (recommended for RamNode VPS)
    • • Debian 9+ (Stretch and newer)
    • • CentOS 7+ / RHEL 7+
    • • Fedora 28+
    2

    Installation Process

    Step 1: System Update and Dependencies

    Install Dependencies
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y curl wget gnupg2 software-properties-common
    sudo apt install -y fuse uuid-runtime
    sudo apt install -y build-essential git

    Step 2: Download and Install JuiceFS

    Install JuiceFS Binary
    # Download JuiceFS binary
    wget https://github.com/juicedata/juicefs/releases/latest/download/juicefs-linux-amd64.tar.gz
    
    # Extract and install
    tar -xzf juicefs-linux-amd64.tar.gz
    sudo mv juicefs /usr/local/bin/
    sudo chmod +x /usr/local/bin/juicefs
    
    # Verify installation
    juicefs version

    Step 3: Configure FUSE

    Enable FUSE Access
    # Add user to fuse group
    sudo usermod -a -G fuse $USER
    
    # Configure FUSE settings
    echo 'user_allow_other' | sudo tee -a /etc/fuse.conf
    
    # Reload groups (or logout/login)
    newgrp fuse
    3

    Metadata Engine Configuration

    JuiceFS supports multiple metadata engines. Choose based on your needs:

    Option A: Redis Configuration (Recommended)

    Install and Configure Redis
    # Install Redis
    sudo apt install -y redis-server
    
    # Start and enable Redis
    sudo systemctl start redis-server
    sudo systemctl enable redis-server
    
    # Test Redis connection
    redis-cli ping
    /etc/redis/redis.conf - Key Settings
    # Add or modify these settings:
    maxmemory 512mb
    maxmemory-policy allkeys-lru
    save 900 1
    save 300 10
    save 60 10000

    Option B: SQLite Configuration (Simple Setup)

    SQLite requires no additional installation - metadata is stored in a local file:

    Create Metadata Directory
    # Create metadata directory
    sudo mkdir -p /var/lib/juicefs
    sudo chown $USER:$USER /var/lib/juicefs
    
    # SQLite URL format:
    # sqlite3:///var/lib/juicefs/metadata.db
    4

    Object Storage Setup

    JuiceFS supports various object storage backends:

    Option A: Local Storage (Development/Testing)

    Setup Local Storage
    # Create local storage directory
    sudo mkdir -p /var/lib/juicefs/storage
    sudo chown $USER:$USER /var/lib/juicefs/storage
    
    # Local storage URL format:
    # file:///var/lib/juicefs/storage

    Option B: AWS S3 or S3-Compatible Storage

    Configure S3 Credentials
    # Install AWS CLI
    sudo apt install -y awscli
    
    # Configure AWS credentials
    aws configure
    # Enter: Access Key ID, Secret Access Key, Region, Output format
    
    # For S3-compatible storage:
    export AWS_ACCESS_KEY_ID="your-access-key"
    export AWS_SECRET_ACCESS_KEY="your-secret-key"
    export AWS_ENDPOINT_URL="https://your-endpoint.com"
    
    # S3 URL format:
    # s3://your-bucket-name/path/

    Option C: MinIO (Self-hosted S3)

    Setup MinIO
    # Download and install MinIO
    wget https://dl.min.io/server/minio/release/linux-amd64/minio
    sudo mv minio /usr/local/bin/
    sudo chmod +x /usr/local/bin/minio
    
    # Create MinIO storage directory
    sudo mkdir -p /var/lib/minio
    sudo chown $USER:$USER /var/lib/minio
    
    # Start MinIO server
    export MINIO_ROOT_USER="minioadmin"
    export MINIO_ROOT_PASSWORD="your-secure-password"
    minio server /var/lib/minio --address ":9000" --console-address ":9001"
    
    # MinIO URL format:
    # minio://minioadmin:your-secure-password@localhost:9000/bucket-name/path/
    5

    File System Creation and Mounting

    Step 1: Format JuiceFS Volume

    Format with Redis + Local Storage
    juicefs format \
      --storage file \
      --bucket /var/lib/juicefs/storage \
      redis://localhost:6379/1 \
      myvol
    Format with SQLite + Local Storage
    juicefs format \
      --storage file \
      --bucket /var/lib/juicefs/storage \
      sqlite3:///var/lib/juicefs/metadata.db \
      myvol
    Format with Redis + S3 Storage
    juicefs format \
      --storage s3 \
      --bucket s3://your-bucket-name \
      redis://localhost:6379/1 \
      myvol

    Step 2: Create Mount Point

    Create Mount Directory
    sudo mkdir -p /mnt/juicefs
    sudo chown $USER:$USER /mnt/juicefs

    Step 3: Mount JuiceFS

    Mount Options
    # Mount with Redis
    juicefs mount redis://localhost:6379/1 /mnt/juicefs
    
    # Mount with SQLite
    juicefs mount sqlite3:///var/lib/juicefs/metadata.db /mnt/juicefs
    
    # Mount in background (daemon mode)
    juicefs mount -d redis://localhost:6379/1 /mnt/juicefs

    Step 4: Verify Mount

    Test Mount
    # Check if JuiceFS is mounted
    df -h /mnt/juicefs | grep juicefs
    
    # Test write operations
    echo "Hello JuiceFS" > /mnt/juicefs/test.txt
    cat /mnt/juicefs/test.txt
    ls -la /mnt/juicefs/
    6

    Performance Optimization

    Cache Configuration

    Optimized Cache Settings
    # Create dedicated cache directory
    sudo mkdir -p /var/cache/juicefs
    sudo chown $USER:$USER /var/cache/juicefs
    
    # Mount with optimized cache settings
    juicefs mount \
      --cache-dir /var/cache/juicefs \
      --cache-size 2048 \
      --free-space-ratio 0.2 \
      --cache-partial-only false \
      redis://localhost:6379/1 /mnt/juicefs

    Network Optimization

    High-Throughput Settings
    juicefs mount \
      --max-uploads 20 \
      --max-downloads 20 \
      --upload-limit 100 \
      --download-limit 100 \
      --buffer-size 300 \
      redis://localhost:6379/1 /mnt/juicefs

    Redis Metadata Engine Tuning

    /etc/redis/redis.conf - Performance Tuning
    maxmemory 1gb
    maxmemory-policy allkeys-lru
    tcp-keepalive 60
    timeout 300
    Restart Redis
    sudo systemctl restart redis-server
    7

    Security Configuration

    Encryption at Rest

    Enable Encryption
    # Generate encryption key
    openssl rand -hex 32 > /etc/juicefs.key
    sudo chmod 600 /etc/juicefs.key
    
    # Format volume with encryption
    juicefs format \
      --storage s3 \
      --bucket s3://your-encrypted-bucket \
      --encrypt-rsa-key /etc/juicefs.key \
      redis://localhost:6379/1 \
      encrypted-vol

    Access Control

    Set Permissions
    # Set proper permissions on mount point
    sudo chown root:users /mnt/juicefs
    sudo chmod 775 /mnt/juicefs
    
    # Create user-specific directories
    sudo mkdir -p /mnt/juicefs/users/$USER
    sudo chown $USER:$USER /mnt/juicefs/users/$USER
    sudo chmod 700 /mnt/juicefs/users/$USER

    Firewall Configuration

    UFW Firewall Rules
    # Configure UFW firewall
    sudo ufw allow 6379/tcp               # Redis
    sudo ufw allow 9000/tcp               # MinIO (if using)
    
    # For production, restrict Redis access to specific IPs
    sudo ufw allow from 10.0.0.0/8 to any port 6379
    sudo ufw deny 6379
    8

    Monitoring & Maintenance

    System Monitoring

    JuiceFS Status Commands
    # Check JuiceFS status
    juicefs status redis://localhost:6379/1
    
    # Monitor mount points
    juicefs info /mnt/juicefs
    
    # Check cache usage
    du -sh /var/cache/juicefs

    Log Management

    Enable Logging
    # Enable JuiceFS logging
    mkdir -p /var/log/juicefs
    
    # Mount with logging
    juicefs mount \
      --log /var/log/juicefs/mount.log \
      --verbose \
      redis://localhost:6379/1 /mnt/juicefs
    
    # Monitor logs
    tail -f /var/log/juicefs/mount.log

    Maintenance Tasks

    Routine Maintenance
    # Clean cache periodically
    juicefs warmup --cache-size 1024 /mnt/juicefs
    
    # Check file system integrity
    juicefs fsck redis://localhost:6379/1
    
    # Update JuiceFS binary
    wget https://github.com/juicedata/juicefs/releases/latest/download/juicefs-linux-amd64.tar.gz
    tar -xzf juicefs-linux-amd64.tar.gz
    sudo mv juicefs /usr/local/bin/
    9

    Troubleshooting

    Common Issues and Solutions

    Issue: Mount fails with permission denied
    Fix FUSE Permissions
    # Check FUSE permissions
    ls -la /dev/fuse
    groups $USER
    
    # Fix FUSE group membership
    sudo usermod -a -G fuse $USER
    newgrp fuse
    
    # Verify fuse.conf
    cat /etc/fuse.conf | grep user_allow_other
    Issue: Metadata engine connection fails
    Test Redis Connection
    # Test Redis connection
    redis-cli -h localhost -p 6379 ping
    
    # Check Redis logs
    sudo journalctl -u redis-server -f
    
    # Restart Redis
    sudo systemctl restart redis-server

    Diagnostic Commands

    Comprehensive Diagnostics
    # Comprehensive system check
    juicefs version
    juicefs status redis://localhost:6379/1
    juicefs info /mnt/juicefs
    
    # Check mount status
    mount | grep juicefs
    ps aux | grep juicefs
    lsof +f -- /mnt/juicefs
    10

    Backup & Recovery

    Metadata Backup

    Backup Metadata
    # Backup Redis metadata
    redis-cli --rdb /backup/juicefs-metadata-$(date +%Y%m%d).rdb
    
    # Backup SQLite metadata
    cp /var/lib/juicefs/metadata.db /backup/metadata-$(date +%Y%m%d).db

    Automated Backup Script

    backup-juicefs.sh
    #!/bin/bash
    BACKUP_DIR="/backup/juicefs"
    mkdir -p $BACKUP_DIR
    DATE=$(date +%Y%m%d_%H%M%S)
    
    # Backup metadata
    if [[ -f /var/lib/juicefs/metadata.db ]]; then
      cp /var/lib/juicefs/metadata.db $BACKUP_DIR/metadata_$DATE.db
    else
      redis-cli --rdb $BACKUP_DIR/metadata_$DATE.rdb
    fi
    
    # Backup configuration
    cp /etc/juicefs.key $BACKUP_DIR/juicefs_$DATE.key 2>/dev/null || true
    
    # Cleanup old backups (keep 7 days)
    find $BACKUP_DIR -name "*" -mtime +7 -delete

    Disaster Recovery

    Document Recovery Information
    # Document your JuiceFS configuration
    echo "# JuiceFS Recovery Information" > /root/juicefs-recovery.txt
    echo "Metadata Engine: redis://localhost:6379/1" >> /root/juicefs-recovery.txt
    echo "Object Storage: s3://your-bucket-name" >> /root/juicefs-recovery.txt
    echo "Volume Name: myvol" >> /root/juicefs-recovery.txt
    echo "Encryption Key: /etc/juicefs.key" >> /root/juicefs-recovery.txt
    
    # Recovery steps:
    # 1. Install JuiceFS on new server
    # 2. Restore metadata engine
    # 3. Configure object storage access
    # 4. Mount existing volume
    juicefs mount redis://localhost:6379/1 /mnt/juicefs-recovered

    Ready to Deploy JuiceFS?

    Get started with RamNode's reliable VPS infrastructure for your cloud-native distributed storage.