Overview
S2 Lite stores all data in object storage through SlateDB. This guide covers backup strategies, disaster recovery, and data migration approaches.Understanding S2 Lite Storage
Storage Architecture
S2 Lite uses SlateDB which stores data entirely in object storage:--path prefix you specify when running S2 Lite.
Data Model
SlateDB organizes S2 data using these key prefixes:- Basin metadata:
/basin/{name}/meta - Stream metadata:
/stream/{basin}/{stream}/meta - Stream records:
/stream/{basin}/{stream}/records/{seq} - Stream tail positions:
/stream/{basin}/{stream}/tail - Fencing tokens:
/stream/{basin}/{stream}/fence
lite/src/backend/kv/mod.rs for the complete data model.
Backup Strategies
Strategy 1: Object Storage Native Backups
AWS S3 Versioning + Lifecycle
Enable S3 versioning
Configure lifecycle policy
Test recovery
S3 Replication (Cross-Region)
Create destination bucket
Create replication IAM role
Configure replication
Cloudflare R2 Replication
Cloudflare R2 doesn’t support automatic replication yet, but you can use object lifecycle policies:Tigris Automatic Backups
Tigris provides automatic multi-region replication and point-in-time recovery. No additional configuration needed.Strategy 2: Snapshot-Based Backups
Create point-in-time snapshots by copying the entire S2 Lite path:Create snapshot script
Schedule with CronJob
Create IAM role for backup job
Strategy 3: Stream-Level Backups
Export individual streams to separate storage:Export stream to file
Automated export script
Restore Procedures
Restore from Object Storage Backup
Full Restore
Stop S2 Lite
Restore from backup
Start S2 Lite
Verify data
Point-in-Time Recovery
Recover to a specific point in time using S3 versioning:Restore Individual Streams
Import stream from backup
Create stream
Append records
Cross-Region Failover
Switch to a replica bucket in another region:Update S2 Lite configuration
Upgrade deployment
Verify failover
Data Migration
Migrate Between Object Stores
Move S2 Lite data from one object storage provider to another:Stop S2 Lite
Copy data to new bucket
Update S2 Lite configuration
Start S2 Lite with new bucket
Verify migration
Blue-Green Migration
Zero-downtime migration strategy:Copy data to new bucket
Deploy new S2 Lite (green)
Switch traffic
Cleanup old deployment
Disaster Recovery Plan
RTO and RPO Targets
DR Checklist
Document configuration
- Record bucket names, regions, endpoints
- Save Helm values files in version control
- Document IAM roles and policies
- List all basins and critical streams
Enable backups
- Enable S3 versioning
- Configure lifecycle policies
- Set up cross-region replication (critical deployments)
- Schedule snapshot backups
Test recovery procedures
- Perform quarterly restore tests
- Validate backup integrity
- Measure actual RTO/RPO
- Update runbooks based on results
Monitor backup status
- Set up alerts for replication lag
- Monitor backup job failures
- Track backup storage costs
Emergency Recovery Runbook
-
Assess the situation
- Identify scope of data loss
- Determine last known good state
- Choose recovery strategy
-
Stop S2 Lite
-
Restore data (choose one)
- S3 versioning: Restore specific versions
- Replication: Switch to replica bucket
- Snapshot: Sync from backup path
-
Restart S2 Lite
-
Verify recovery
- Check health endpoint
- List basins and streams
- Validate critical data
- Test write operations
-
Document incident
- Record timeline
- Note data loss (if any)
- Update procedures