Docs Navigation
Docs/Operations & Optimization

Storage & Cold Storage Setup

Configuring Cloudflare R2 / AWS S3 offloading, TTL workers, and background vacuuming.

Last Updated: August 2026

Setting Up Postgres & MongoDB Cold Storage on Cloudflare R2

Offload historical database segments to Cloudflare R2 to pay $0 for egress and $0.015/GB/month for storage:

bashKOLMOS Reference
# Environment configuration for R2 Object Storage offloading:
export KOLMOS_STORAGE_TIER=hybrid
export KOLMOS_S3_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com
export KOLMOS_S3_BUCKET=kolmos-cold-storage
export KOLMOS_S3_ACCESS_KEY_ID=<your-access-key>
export KOLMOS_S3_SECRET_ACCESS_KEY=<your-secret-key>

# Run KOLMOS with cold storage offloading enabled:
./kolmos serve --root ./data --cold-tier-enabled true

Background Vacuuming & TTL Workers

KOLMOS automatically runs two background maintenance processes: - **Vacuum Worker:** Runs every 10 minutes to compact deleted tombstone rows and reclaim disk space. - **TTL Worker:** Scans collections with `expireAfterSeconds` index specs every 60 seconds to purge expired documents.