# MadBase Storage & Persistence MadBase uses a tiered storage approach combining local persistence, distributed databases, and S3-compatible object storage. ## 1. Local Block Storage Nodes use local NVMe/SSD storage for high-performance service data: - **Database**: PostgreSQL data stored in `/var/lib/postgresql/data`. - **Metrics**: VictoriaMetrics data stored in `/victoria-metrics-data`. - **Logs**: Loki chunks stored in `/loki`. ## 2. Object Storage (S3) Used for backups, static assets, and long-term state retention. - **Backups**: Database backups are automatically piped to S3-compatible buckets. - **Provider**: Works with Hetzner Bucket Storage, AWS S3, or MinIO. ### Configuration ```bash S3_ENDPOINT="https://fsn1.your-storage-endpoint.com" S3_ACCESS_KEY="your_key" S3_SECRET_KEY="your_secret" S3_BUCKET="madbase-backups" ``` ## 3. Backup & Restore ### Manual Backup ```bash curl -X POST http://localhost:8001/api/v1/cluster/database/backup ``` ### Manual Restore ```bash curl -X POST http://localhost:8001/api/v1/cluster/database/restore \ -d '{"backup_url": "s3://..."}' ``` ## 4. Planning & Capacity - **DB Nodes**: Scale vertically (RAM) for active datasets; scale horizontally (Nodes) for read-throughput and HA. - **Retention**: Configure VictoriaMetrics and Loki retention periods in the System Node config to manage disk usage.