Nishant Chaudhary
03/16/2026, 7:02 AMBACKUP DATABASE ... TO REPOSITORY command isn't supported in shared-data mode, we have enabled meta-data snapshots but for accidental updates to tables, or corruption in data etc. for taking the full data backup, we come up with:
1. enabled versioning on s3.
2. use aws backup to take backup of s3, which we will be storing for last 2-3days.
but since our data is growing as currently we have around 4TB data, this approach is becoming somewhat costly.
So, wanted to know from team is there any other recommended way of doing full periodic backups for shared-data clusters?Rocky
03/16/2026, 7:50 AM--cluster_snapshot flag.
* Check Status: Query the snapshot status via:
sql
SELECT * FROM information_schema.cluster_snapshots;
2. "Time Travel" & Metadata Rollback (The "Second-Level" Recovery)
For accidental updates or deletes, you don't need a full restore. Shared-data mode supports a high-performance recovery mechanism that rolls back table metadata to a previous healthy version.
* Mechanism: StarRocks keeps historical versions of tablet metadata on S3.
* Action: You can use the ADMIN REPAIR TABLE statement to roll back a table to a specific historical version or timestamp. This is nearly instantaneous because it only changes metadata pointers, not the data files themselves.
* Benefit: This avoids the cost and time of moving 4TB of data.
3. Cost Optimization: S3 Lifecycle Policies vs. AWS Backup
Since you find AWS Backup costly for 4TB+, you can achieve the same protection at a lower cost using native S3 features:
* S3 Object Versioning (Already enabled): This is your primary defense.
* S3 Lifecycle Rules: Instead of using the "AWS Backup" service, create Lifecycle Rules on your bucket to:
* Transition non-current versions of objects to S3 Standard-IA or S3 Glacier Instant Retrieval after 1–2 days. This significantly reduces storage costs while keeping the data accessible for StarRocks' metadata rollback.
* Expire (delete) non-current versions after your required retention period (e.g., 7 days).
* Why this is cheaper: You avoid the management fees of the AWS Backup service and leverage cheaper storage tiers for the "deltas" and old versions.
4. Periodic Metadata Backups
While you have the cluster snapshot, it's a good practice to periodically back up the FE meta directory (or the image files). In Kubernetes:
* You can use a CronJob to trigger an ALTER SYSTEM CREATE IMAGE and then upload the resulting image from the FE's meta/image directory to a separate S3 prefix.
Summary Recommendation:
1. Keep S3 Versioning enabled but replace the "AWS Backup" service with S3 Lifecycle Policies to move old versions to cheaper tiers (like Glacier Instant Retrieval).
2. Ensure Cluster Snapshots are configured so that your FE metadata is safely stored alongside your data in S3.
3. Use the ADMIN REPAIR TABLE command for "Point-in-Time" style recovery for accidental data changes, as it is the most efficient way to recover in Shared-Data mode.
Does this help clarify the strategy, or would you like more details on the ADMIN REPAIR syntax for your specific version?
References
• deployment/shared_data/hdfs.md
• deployment/shared_data/minio.mdRocky
03/16/2026, 7:50 AMNishant Chaudhary
03/16/2026, 11:35 AMRocky
03/16/2026, 11:36 AMADMIN REPAIR.
1. Remote Data Backup & Restore (Full Data + Metadata)
Contrary to the idea that snapshots only track metadata, the BACKUP command in StarRocks creates a point-in-time snapshot of the actual data files and uploads them to a remote repository (like S3, HDFS, or MinIO).
* Behavior: When you run BACKUP, StarRocks snapshots the data (SSTables/Segments) and the metadata. This data is physically moved to your external storage.
* Recovery from Deletion: If a user accidentally deletes a table or database, you can use the RESTORE command to pull that data back from the remote repository. It will recreate the table and restore the data to the exact state it was in at the time of the backup.
* Syntax Example:
sql
BACKUP SNAPSHOT your_db.snapshot_label
TO your_repository
ON (your_table);
2. The RECOVER Command (For Accidental Deletion)
If a database, table, or partition is deleted using the DROP command, StarRocks does not physically delete the data immediately. It moves it to a "trash" bin.
* How it works: Data is kept in the trash for a configurable period (default is 1 day, controlled by the FE config catalog_trash_expire_second).
* Usage: You can instantly recover the deleted data without needing to restore from an external backup:
sql
RECOVER TABLE your_table;
Note: This does not work if you used DROP TABLE ... FORCE or TRUNCATE.
3. Cross-Cluster Replication (CCR)
If you need a "Full Cluster" behavior for Disaster Recovery (DR), you can use Cross-Cluster Replication.
* Behavior: This feature synchronizes data from a primary cluster to a secondary cluster at the database or table level. If your primary cluster suffers a catastrophic failure or significant data loss, you can failover to the secondary cluster which contains the replicated data.
4. Shared-Data Architecture Rollback (v3.0+)
If you are using the Shared-data (Cloud-native) architecture, StarRocks provides a unique way to handle corruption or accidental loss through Metadata Rollback:
* Mechanism: Since data is stored on object storage, StarRocks maintains historical versions of the metadata. You can use an enhanced ADMIN REPAIR TABLE to roll back the table's metadata to a "last known healthy" version.
* Benefit: This is nearly instantaneous (second-level recovery) even for PB-scale data because it only swaps the metadata pointers back to an older, healthy state on S3.
Summary Comparison
Feature | Protects Against | Recovery Speed | Notes
BACKUP/RESTORE | Data Deletion, Corruption, Site Failure | Slow (Data Movement) | Full physical copy to S3/HDFS.
RECOVER | DROP statements | Instant | Dependent on catalog_trash_expire_second.
CCR | Full Cluster Failure | Fast (Switchover) | Requires a second standby cluster.
Admin Repair (Shared-Data) | Data Corruption/Inconsistency | Instant | Rollback to historical metadata versions.
My recommendation: For a traditional "full backup" safety net, set up a Remote Repository and schedule regular BACKUP jobs. This ensures that even if the entire cluster's local disks are wiped, your data is safe on object storage.
References
• administration/Data_recovery.md
• sql-reference/sql-statements/backup_restore/RECOVER.md
• faq/shared_data_faq.md
• faq/Others.mdRocky
03/16/2026, 11:39 AMBACKUP and RESTORE commands used in shared-nothing setups are currently not supported for shared-data clusters.
However, your understanding of Cluster Snapshots and ADMIN REPAIR can be refined to help you build a robust recovery strategy. Here is the breakdown of how you can achieve "full cluster + data" protection:
1. Cluster Snapshots: The "Brain" Backup
You are right that Cluster Snapshots track metadata, but in a shared-data architecture, metadata is the state of your data.
* What it does: It captures FE journals and StarManager journals. This includes table schemas, user permissions, and—crucially—the exact versions of data files (SSTables/segments) that make up your tables at that moment.
* The Gap: It does not "copy" the actual data files; it assumes those files exist in your object storage (S3/GCS/Azure Blob). If a file is deleted from the S3 bucket itself, the snapshot will point to a missing object.
2. Data Deletion Recovery: The "Recycle Bin"
For accidental SQL-level deletions (e.g., DROP TABLE), StarRocks has a built-in safety net:
* RECOVER command: If you run DROP TABLE <name>, StarRocks doesn't delete the data immediately. It moves it to a "Trash" for a period (default 1 day, configured by catalog_trash_expire_second). You can use RECOVER TABLE <name> to bring it back instantly.
* Note: If you use DROP TABLE <name> FORCE, it bypasses the trash and is unrecoverable via this method.
3. `ADMIN REPAIR`: The "Time Machine"
While ADMIN REPAIR is often for corruption, in shared-data clusters, it has been extended to handle file loss:
* Mechanism: If files are accidentally deleted from object storage, StarRocks can scan historical metadata to find the last "healthy" version of a Tablet where all files still exist. It then rolls back the metadata to that version.
* Result: You might lose a few minutes of the most recent data, but you restore the table's availability without a full restore.
4. How to achieve "Full Cluster + Data Backup"
Since StarRocks doesn't have a single "Backup Everything" button for shared-data yet, the industry-standard approach is to combine StarRocks features with Object Storage features:
Protection Level | Tool/Feature | Why it's needed
Metadata / State | Cluster Snapshots | Restores the cluster's logic, users, and table structures.
Actual Data Files | Object Storage Versioning | In S3/GCS, enable Versioning. If a file is deleted or corrupted, you can roll back the object to a previous version.
Disaster Recovery | Cross-Region Replication | Syncs your S3 bucket to another region. Combined with a Cluster Snapshot, you can spin up a brand new cluster in a different region.
Immutable Backup | Object Lock (WORM) | Prevents any data from being deleted (even by StarRocks or a malicious actor) for a set retention period.
Summary Recommendation
If you want a setup that replicates "Full Cluster + Data Backup":
1. Enable Automated Cluster Snapshots: Use ADMIN SET AUTOMATED CLUSTER SNAPSHOT ON.
2. Enable S3/Object Storage Versioning: This protects you against the "actual data" being deleted or corrupted at the storage layer.
3. Set `catalog_trash_expire_second`: Give yourself a 24-48 hour window to use the RECOVER command for accidental DROP statements.
By combining S3 Versioning (the data) with Cluster Snapshots (the metadata), you have a complete, recoverable copy of your entire environment.
References
• administration/management/resource_management/Replica.md
• administration/Data_recovery.md