<@U0A71G31CDV> I'd like to know if backing up star...
# questions-and-troubleshooting
g
@Rocky I'd like to know if backing up starrocks data using a physical disk snapshot works. I know about Starrocks snapshots, but our current model for backups does disk snapshots.
r
While you can technically perform physical disk snapshots (like AWS EBS snapshots or VM-level snapshots) for StarRocks, it is generally not the recommended primary method for backups due to the complexities of distributed consistency. Here is a breakdown of why this approach is risky and what the official StarRocks recommendations are: 1. The Distributed Consistency Challenge StarRocks is a distributed system consisting of Frontend (FE) nodes (storing metadata) and Backend (BE) nodes (storing actual data). * Metadata vs. Data Mismatch: If you take a snapshot of an FE and then a snapshot of a BE even a few seconds apart, they may become out of sync. For example, the FE metadata might indicate that a transaction is "Committed," but the BE snapshot might have been taken before those specific data files (segments) were fully written to disk. * Global State: To restore a cluster from disk snapshots, you would need to snapshot every node in the cluster at the exact same logical point in time. Most cloud snapshot tools operate on a per-volume basis, making it extremely difficult to achieve a "cluster-wide consistent" state. 2. Recommended Approach: StarRocks
BACKUP
The official way to back up StarRocks is using the built-in
BACKUP
and
RESTORE
commands. * Application-Level Consistency: StarRocks handles the coordination between FE and BE to ensure that the snapshot is internally consistent. * Storage Efficiency: It creates a point-in-time snapshot and then uploads it to a remote repository (S3, HDFS, GCS, or MinIO). * Granularity: You can back up an entire database, specific tables, or even individual partitions. 3. Shared-Data (Compute-Storage Separated) Clusters If you are using StarRocks in shared-data mode (v3.0+), your data is already stored in object storage (like S3). In this case: * Physical snapshots of CN (Compute) nodes are unnecessary, as they are stateless. * Cluster Snapshot (v3.4.2+): StarRocks now supports a dedicated
Cluster Snapshot
feature for shared-data clusters. This automatically captures the full cluster state (metadata in FE) and maps it to the data in object storage. You can enable it with:
Copy code
sql
    ADMIN SET AUTOMATED CLUSTER SNAPSHOT ON;
4. If you must use Disk Snapshots If your organization requires disk snapshots for compliance or existing workflows, keep the following in mind: * Stop Ingestion: Ideally, stop all data loading (Stream Load, Routine Load, etc.) and wait for a few minutes to ensure all data is flushed and "published" before taking snapshots. * Quiesce the Cluster: While not strictly required for file integrity (StarRocks files are generally immutable once written), it is the only way to ensure FE and BE snapshots are synchronized. * Metadata Recovery: Restoring from disk snapshots is essentially treated like a "hard crash" recovery. While StarRocks is resilient to crashes, there is a risk that the BDBJE (the metadata store in FE) or the BE tablet versions might require manual reconciliation if they are restored to different points in time. Summary Recommendation: Use the StarRocks
BACKUP
command to store snapshots in a repository (S3/HDFS). This is the only way to guarantee a consistent, restorable state across the entire distributed cluster. If you are on a recent version and using shared-data, use the Cluster Snapshot feature. Referencesadministration/cluster_snapshot.mdadministration/management/BE_configuration.md
r
Not recommended to use physical disk. Snapshot feature will likely cause metadata issue if there's more ingestion happening after snapshot is taken.