maryam
05/17/2026, 1:22 PMRocky
05/17/2026, 1:23 PMreplication_num = 3 for all tables. This ensures that if a BE node or its disk fails, StarRocks automatically serves data from other replicas and initiates a background repair.
* FE Quorum: Deploy at least 3 FEs (1 Leader, 2 Followers). This allows the cluster to survive the loss of one FE node via Raft-based leader election.
B. Backup & Restore (RTO: Hours)
Regular snapshots protect against data corruption or accidental DROP TABLE commands.
* Create a Repository: Link StarRocks to an external object store (S3, MinIO, or HDFS).
sql
CREATE REPOSITORY my_s3_repo
WITH BROKER
ON LOCATION "<s3a://my-bucket/starrocks_backups>"
PROPERTIES (
"aws.s3.access_key" = "...",
"aws.s3.secret_key" = "...",
"aws.s3.region" = "us-east-1"
);
* Schedule Backups: Use the BACKUP command to create snapshots of critical databases or tables.
sql
BACKUP SNAPSHOT sample_db.snapshot_label TO my_s3_repo;
* Restoration: In a total cluster failure, deploy a fresh cluster and run RESTORE.
C. Cross-Cluster Replication (CCR) (RTO: Minutes)
For multi-region DR, maintain a Primary-Standby setup. StarRocks supports CCR to replicate data from a primary cluster to a standby cluster in near real-time.
* Setup: Enable CCR on the Standby cluster to pull data from the Primary.
* Failover: If the Primary goes down, redirect application traffic to the Standby cluster.
──────────
2. Kubernetes Level
On Kubernetes, the StarRocks Operator manages the lifecycle. DR at this level focuses on infrastructure resilience.
A. Multi-AZ Deployment
* Anti-Affinity: Use Pod Anti-Affinity in your StarRocksCluster YAML to ensure FE and BE pods are distributed across different nodes and Availability Zones (AZs).
* StorageClass: Use an AZ-aware StorageClass. For shared-nothing, local NVMe or high-performance EBS/PD with volumeBindingMode: WaitForFirstConsumer is recommended.
B. Persistent Volume (PV) Management
* Reclaim Policy: Set the reclaimPolicy to Retain in your StorageClass. If a namespace is accidentally deleted, the data on the disks remains intact.
* Volume Snapshots: If your CSI driver supports it, take periodic K8s Volume Snapshots. However, note that StarRocks' internal BACKUP is more consistent for database recovery.
C. FE Metadata Protection
The FE metadata (BDB JE) is the "brain" of the cluster.
* PV Backup: Ensure the FE's metadata directory (/opt/starrocks/fe/meta) is on a reliable Persistent Volume.
* Manual Recovery: If the FE metadata is corrupted and the quorum is lost, use the bdbje_reset_election_group configuration to force-start a single FE and reconstruct the cluster.
D. Multi-Cluster DR (K8s level)
* Global Load Balancer: Use a Global Server Load Balancer (GSLB) or Route53 to route traffic between StarRocks clusters in different K8s clusters/regions.
* GitOps: Store your StarRocks Cluster CRD and configurations in Git (e.g., ArgoCD). This allows you to recreate the entire StarRocks environment in a new K8s cluster within minutes.
──────────
3. Disaster Recovery Matrix
Scenario | Recovery Mechanism | Level
Node/Disk Failure | Multi-replica (replication_num: 3) | StarRocksRocky
05/17/2026, 1:23 PMRESTORE from S3 Repository | StarRocks
AZ Outage | Multi-AZ Anti-Affinity & FE Quorum | Kubernetes
Region/K8s Failure | Cross-Cluster Replication (CCR) to Standby | Both
Metadata Corruption | bdbje_reset_election_group & Meta Backup | StarRocks
Recommendations
1. Test your Restore: A backup is only as good as its last successful restore test.
2. Monitor Quorum: Use Prometheus/Grafana to alert if alive FE or BE counts drop.
3. Version Consistency: Ensure the Standby cluster (for CCR) runs the same or a newer version of StarRocks as the Primary.
References
• deployment/sr_operator.md
• deployment/helm.mdmaryam
05/17/2026, 1:35 PMRocky
05/17/2026, 1:36 PMimage file), the system automatically triggers a snapshot and uploads it to your configured storage volume.
* Enable it:
sql
-- 1. Create a storage volume (S3/MinIO/GCS/HDFS)
CREATE STORAGE VOLUME my_backup_volume
TYPE = S3
LOCATIONS = ("<s3://my-bucket/starrocks_backups/>")
PROPERTIES ("aws.s3.region" = "us-east-1");
-- 2. Enable automated snapshots
ADMIN SET AUTOMATED CLUSTER SNAPSHOT ON STORAGE VOLUME my_backup_volume;
* Configuration: You can control the frequency using the FE parameter automated_cluster_snapshot_interval_seconds (default is 600 seconds/10 minutes).
2. Kubernetes Level: Volume Snapshots (Recommended for K8s)
Since you are on Kubernetes, the most robust way to back up FE metadata is to snapshot the Persistent Volumes (PVs) attached to the FE pods. FE metadata is stored in the /opt/starrocks/fe/meta directory inside the pod.
* Using Velero: Use Velero with the CSI plugin to schedule periodic backups of the entire StarRocks namespace. Velero will trigger snapshots of the FE PVs and store the metadata in object storage.
* Native K8s VolumeSnapshot: If your StorageClass supports CSI snapshots, you can create a CronJob in Kubernetes that periodically creates a VolumeSnapshot resource for your FE pods.
yaml
# Example snippet for a VolumeSnapshot
apiVersion: <http://snapshot.storage.k8s.io/v1|snapshot.storage.k8s.io/v1>
kind: VolumeSnapshot
metadata:
name: fe-meta-snapshot-timestamp
spec:
volumeSnapshotClassName: csi-aws-vsc
source:
persistentVolumeClaimName: fe-meta-pvc-starrocks-fe-0
3. Sidecar "Sync" Method (Version Agnostic)
If you are on an older version and cannot use VolumeSnapshots, you can add a sidecar container to your FE deployment (via the StarRocks Operator spec.starrocksFeSpec.sidecarContainers).
* Sidecar Logic: The sidecar runs a script that uses aws s3 sync or gsutil rsync to monitor the /opt/starrocks/fe/meta directory and upload new image.* files to object storage.
* Triggering Images: You can force the FE to create a fresh metadata image periodically via a cron job that executes:
sql
ALTER SYSTEM CREATE IMAGE;
Summary of FE Meta Storage
FE metadata consists of two main parts:
1. Image Files (meta/image): A full snapshot of the metadata at a specific point in time.
2. Edit Logs (meta/bdb): Incremental changes (journals) since the last image.
Important: For a valid backup, you should at least have the latest image file. If you only have the image, you can restore the cluster to the state at the time the image was created. If you have both the image and the subsequent edit logs, you can restore to the latest state.
References
• administration/management/FE_configuration.md
• administration/Meta_recovery.md
• faq/operation_maintenance_faq.mdRocky
05/17/2026, 1:40 PMmeta volume.
* Automation:
bash
# Schedule a daily backup of FE metadata volumes
velero schedule create sr-metadata-daily --schedule="0 1 _ _ *" --include-namespaces starrocks --selector "<http://app.kubernetes.io/component=fe|app.kubernetes.io/component=fe>"
2. Database Level: Cross-Cluster Replication (CCR)
If you need an "always-on" automated metadata backup, CCR is the best choice. It automates the replication of both data and metadata from a Primary cluster to a Standby cluster.
* Benefit: The Standby FE is automatically kept in sync with the Primary. If the Primary fails, the Standby already has the metadata loaded.
* Setup: Use the StarRocks CCR operator to link the two clusters.
3. Manual Automation via Sidecar (For Object Storage)
You can automate the off-site backup of the metadata image file by adding a sidecar container to your FE pods via the StarRocks Operator.
1. Trigger Image Creation: Use a CronJob to periodically run the following SQL to ensure the latest metadata is written to disk:
sql
ALTER SYSTEM CREATE IMAGE;
2. Sync to S3/Cloud Storage: Use a sidecar container (e.g., with rclone or aws-cli) that monitors the /opt/starrocks/fe/meta/image directory and uploads new files to a bucket.
_ _Configuration in StarRocksCluster CRD:*
yaml
spec:
starrocksFeSpec:
sidecarContainers:
• name: metadata-uploader
image: amazon/aws-cli
command: ["/bin/sh", "-c"]
args: ["while true; do aws s3 sync /opt/starrocks/fe/meta/image <s3://my-backup-bucket/fe-meta;> sleep 3600; done"]
volumeMounts:
• name: fe-meta
mountPath: /opt/starrocks/fe/meta
4. Backup & Restore (Table Data Only)
Note that the StarRocks BACKUP command primarily backs up table data and schema, not the entire FE system state (like users, permissions, or global variables).
* To automate table-level backups, use a CronJob that calls a script to run:
sql
BACKUP SNAPSHOT db_name.snapshot_label TO my_repo;
Summary Recommendation
* For pure metadata DR: Use Velero or CSI Snapshots of the FE Persistent Volumes. It is the most robust K8s-native way.
* For high-end DR (RTO < 5 mins): Use CCR to maintain a live standby cluster.
* For shared-data clusters: (If you ever switch) Use the native ADMIN SET AUTOMATED CLUSTER SNAPSHOT ON.
References
• administration/cluster_snapshot.md
• administration/Meta_recovery.md
• administration/Backup_and_restore.md
References
• administration/Meta_recovery.md
• quick_start/helm.mdRocky
05/18/2026, 8:42 AMenableFQDN property to true. This configuration tells the StarRocks Operator to start the Frontends (FE) with the --host_type FQDN flag and ensures that Backends (BE) and Compute Nodes (CN) are registered using their Kubernetes DNS names rather than internal IP addresses.
1. Configuration in values.yaml
In the kube-starrocks Helm chart (which includes both the operator and the cluster), add the following to your `values.yaml`:
yaml
starrocks:
starrocksCluster:
enableFQDN: true
If you are using the starrocks (cluster-only) chart or editing the StarRocksCluster Custom Resource (CR) directly:
yaml
spec:
enableFQDN: true
2. What this changes
* Startup Flag: The operator automatically adds --host_type FQDN to the FE startup command.
* Node Registration: When BEs or CNs join the cluster, they will use their stable network identity (e.g., starrocks-be-0.starrocks-be-search.svc.cluster.local) instead of an ephemeral Pod IP.
* Metadata: The FE metadata will store hostnames instead of IPs, making the cluster resilient to Pod restarts or IP changes.
3. Important Considerations
* Version Requirement: FQDN support requires StarRocks version 2.4.0 or later and StarRocks Operator version 1.5.0 or later.
* Priority Networks: If you previously configured priority_networks in your fe.conf or be.conf, you should generally remove or comment out that setting when enableFQDN is true. FQDN mode bypasses the need for IP-based network matching.
* Existing Clusters: If you are enabling FQDN on an existing cluster that was started in IP mode, you must perform a manual migration of the metadata using SQL commands (e.g., ALTER SYSTEM MODIFY FRONTEND HOST...) because the FEs will not be able to recognize their old IP-based identities once restarted in FQDN mode. For a fresh installation via Helm, simply setting the flag is sufficient.
4. Verification
After the pods are running, log into StarRocks via MySQL and check the hostnames:
sql
-- Check FEs
SHOW PROC '/frontends';
-- Check BEs
SHOW PROC '/backends';
The Host or IP columns should show the Kubernetes service domain names instead of numeric IP addresses.
References
• administration/management/enable_fqdn.md
• deployment/environment_configurations.md
• faq/operation_maintenance_faq.mdmaryam
05/18/2026, 9:06 AMRocky
05/18/2026, 9:06 AMBACKUP command does not capture the entire state of the cluster.
1. Metadata Layer (Global State)
The BACKUP command cannot back up global metadata such as users, roles, privileges, resource groups, or cluster configurations.
* Method: Use Velero (to snapshot FE Persistent Volumes) or a Sidecar (to sync the meta/image directory to S3).
* Why: If you lose your FE metadata, you lose your security settings and the "map" of where data is stored on the BEs.
2. Data Layer (Tables & MVs)
The BACKUP command is used to create a point-in-time snapshot of the actual data stored on the Backends (BE).
* Command: BACKUP DATABASE <db_name> SNAPSHOT <label> TO <repository> ...
* Scope (v3.4+): It now supports tables, partitions, logical views, and UDFs.
* Materialized Views:
* Synchronous MVs: Automatically backed up when you back up the base table.
* Asynchronous MVs: Supported since v3.2, but you must ensure the FE config enable_backup_materialized_view is set to true.
* Restore: Use the RESTORE command on the target cluster. You do not need to create the table schema beforehand; the restore process handles it.
──────────
Comparison of DR Strategies for Shared-Nothing
Strategy | Automation Level | Recovery Point Objective (RPO) | Scope
Velero / CSI Snapshots | High | Depends on snapshot frequency | Full Cluster. Backs up FE meta and BE data volumes. Best for K8s.
Meta Sync + BACKUP | Medium (Manual/Scripted) | High (Manual backups take time) | Data + Schema. Misses users/roles unless you sync the FE meta directory separately.
Cross-Cluster Replication (CCR) | Highest | Near Zero | Automated. Continuously syncs data and metadata to a standby cluster.
Recommendation for your Plan
If you are on Kubernetes and your storage supports it, Velero with CSI snapshots is the most robust path because it handles both FE and BE volumes in one workflow.
If you proceed with your manual/sidecar plan:
1. Automate Metadata: Use a sidecar to sync the FE meta folder.
2. Automate Data: Use a K8s CronJob to call a script that executes the BACKUP SQL command.
3. Config Check: If using Asynchronous MVs, set ADMIN SET FRONTEND CONFIG ("enable_backup_materialized_view" = "true");.
References
• administration/management/Backup_and_restore.md
• administration/management/FE_configuration.md
• administration/Meta_recovery.md
• sql-reference/sql-statements/backup_restore/BACKUP.md
References
• administration/management/resource_management/Replica.md
• administration/cluster_snapshot.md
• introduction/Architecture.mdmaryam
05/18/2026, 9:17 AMRocky
05/18/2026, 9:17 AMmeta_dir), which is typically a ReadWriteOnce Persistent Volume that cannot be mounted by other pods (like a standard CronJob) while the FE is running.
1. The Strategy
1. Trigger Snapshot: Run ALTER SYSTEM CREATE IMAGE via a SQL client to force the Leader FE to write the latest metadata to disk.
2. Wait: Since the command is asynchronous, the script waits for the image.<id> file to be generated.
3. Sync to MinIO: Use the mc (MinIO Client) or aws-cli to sync the /opt/starrocks/fe/meta directory to your S3 bucket.
2. Sidecar Configuration (YAML)
Add this to your StarRocksCluster CRD under spec.starRocksFeSpec. This example uses a lightweight image with mysql-client and aws-cli (MinIO is S3-compatible).
yaml
spec:
starRocksFeSpec:
sidecarContainers:
- name: metadata-backup
image: amazon/aws-cli # Includes aws-cli; you can also use a custom image with 'mc'
env:
- name: AWS_ACCESS_KEY_ID
value: "your-minio-access-key"
- name: AWS_SECRET_ACCESS_KEY
value: "your-minio-secret-key"
- name: MINIO_ENDPOINT
value: "<http://minio-service.minio-namespace.svc.cluster.local:9000>"
- name: FE_QUERY_PORT
value: "9030"
command: ["/bin/sh", "-c"]
args:
- |
while true; do
echo "Starting metadata backup..."
# 1. Trigger the image creation (User 'root' with no password example)
# Note: Use a secret for the password in production!
aws s3 --endpoint-url $MINIO_ENDPOINT s3 ls || echo "MinIO connection check failed"
# Execute SQL to create image
# We use 127.0.0.1 because the sidecar shares the network with the FE container
mysql -h 127.0.0.1 -P $FE_QUERY_PORT -u root -e "ALTER SYSTEM CREATE IMAGE;"
echo "Waiting 5 minutes for image to be created..."
sleep 300
# 2. Sync the meta directory to MinIO
# Only sync the 'image' and 'bdb' subdirectories which contain the actual state
aws s3 sync /opt/starrocks/fe/meta <s3://my-backup-bucket/fe-metadata/$(hostname)/> \
--endpoint-url $MINIO_ENDPOINT \
--exclude "fe.log*" \
--no-verify-ssl
echo "Backup completed. Sleeping for 6 hours..."
sleep 21600 # 6 hours
done
volumeMounts:
- name: fe-meta
mountPath: /opt/starrocks/fe/meta
3. Key Script Details
* Targeting the Leader: ALTER SYSTEM CREATE IMAGE only works on the Leader FE. In a multi-FE setup, the script will run on all FEs. On non-leader FEs, the SQL command will fail or be forwarded, but the aws s3 sync will still safely back up the local metadata copy (which is synchronized via BDB JE).
* Directory Path: The meta_dir defaults to /opt/starrocks/fe/meta. Ensure the volumeMounts.name matches the name of the metadata volume defined in your FE spec (usually fe-meta).
* Wait Time: Image creation time depends on the size of your metadata. For most clusters, 5 minutes is sufficient. You can refine this by checking for file timestamps if needed.
4. Recovery
If you need to restore from this backup:
1. Download the meta folder from MinIO.
2. Place it in the meta_dir of a fresh FE.
3. Start the FE with the metadata_enable_recovery_mode = true flag in fe.conf (if the BDB JE logs are fragmented) or simply as a new cluster seed.
Alternative: Kubernetes CronJobRocky
05/18/2026, 9:17 AMCronJob that uses kubectl exec to perform the same steps:
1. kubectl exec <leader-fe-pod> -- mysql -e "ALTER SYSTEM CREATE IMAGE;"
2. kubectl exec <leader-fe-pod> -- mc mirror /opt/starrocks/fe/meta minio/backups
Note: This requires the FE image to have mc or aws-cli installed, or for you to install it at runtime.
References
• administration/management/FE_configuration.md
• administration/Meta_recovery.md
• introduction/Architecture.md
• quick_start/shared-nothing.mdmaryam
05/18/2026, 9:24 AMRocky
05/18/2026, 9:25 AMmeta_dir (defaulting to /opt/starrocks/fe/meta).
Here is how it works in a multi-FE setup:
1. Local Storage for Each Pod
In a Kubernetes deployment, each FE Pod has its own Persistent Volume (PV). Inside that PV, you will find:
* image/ directory: Contains the full snapshot of the metadata (the "Image").
* bdb/ directory: Contains the Berkeley DB (BDB JE) edit logs. These are the incremental changes made since the last image was created.
2. How they stay in sync
StarRocks uses a Leader-Follower architecture to keep these local files identical:
* Leader FE: All metadata changes (like creating a table or adding a user) are first written to the Leader's local BDB logs.
* Follower FEs: They continuously pull these edit logs from the Leader and apply them to their own local metadata files.
* Checkpointing: Periodically, the Leader FE converts the incremental logs into a new image file and pushes it to the Followers so they can prune their old log files.
3. Why this matters for your DR plan
Because each FE has its own copy:
* High Availability: If the Leader FE Pod dies, a Follower already has a nearly identical copy of the metadata and can be elected as the new Leader immediately.
* Backup Strategy: In your sidecar script, you technically only need to back up the metadata from the Leader FE because it is the "source of truth." However, since any Follower can become a Leader, backing up from the current Leader (or all of them) ensures you always have the most recent state.
* Consistency: When you run ALTER SYSTEM CREATE IMAGE;, it tells the Leader to consolidate its logs into a single image file, which then gets synced to all other FEs.
Summary: They do not share a single metadata file; they keep individual copies in sync via the network. This is why you must ensure each FE Pod in your Helm chart has its own Persistent Volume Claim (PVC).
References
• administration/Meta_recovery.md
• introduction/Architecture.md
• administration/management/FE_configuration.md
• faq/operation_maintenance_faq.md
References
• administration/management/FE_configuration.md
• faq/operation_maintenance_faq.md
• administration/Meta_recovery.mdRocky
05/18/2026, 9:25 AMmeta_dir).
While they are separate files on disk, they are kept synchronized to be identical via the following mechanism:
1. Independent Storage
In a Kubernetes or distributed environment, every FE pod has its own local directory (usually a Persistent Volume). Inside this directory (/opt/starrocks/fe/meta), you will find:
* image/: A point-in-time snapshot of the entire cluster's metadata.
* bdb/: The Berkeley DB (BDB JE) logs that record every incremental change (e.g., "Create Table", "Add User") since the last image was created.
2. How Synchronization Works
StarRocks uses a Leader-Follower consensus (based on the Raft protocol) to ensure these separate files stay consistent:
* Leader FE: The only node that can write to the metadata. When you run a command like CREATE TABLE, the Leader writes it to its local BDB log first.
* Follower FEs: They constantly pull new log entries from the Leader and apply them to their own local metadata files.
* Image Checkpointing: Periodically (or manually via ALTER SYSTEM CREATE IMAGE), the Leader merges its logs into a new image file and distributes it to the Followers so they can clean up their old log files.
3. Why this is important for your DR Plan
* Redundancy: If one FE node's disk fails, the other FEs still have the full metadata.
* Backups: You only need to back up the meta directory from one healthy FE (preferably the Leader) to have a complete backup of the cluster's state.
* Recovery: If you lose the entire cluster, you can point a new FE to a restored copy of this meta directory, and it will be able to reconstruct the entire cluster state (users, permissions, table schemas, etc.).
Summary: Each FE has its own physical metadata files, but the content of those files is synchronized across all FEs to ensure they are logically identical.
References
• introduction/Architecture.md
• administration/Meta_recovery.md
• administration/management/FE_configuration.md
• faq/operation_maintenance_faq.md
References
• faq/operation_maintenance_faq.md
• administration/management/FE_configuration.md
• administration/Meta_recovery.md
• introduction/Architecture.mdmaryam
05/18/2026, 10:52 AMRocky
05/18/2026, 10:53 AM/storage directory. Instead, use the StarRocks native backup feature:
sql
-- This backs up both the FE metadata and the actual data from the BEs
-- for a specific database/table and pushes it to your S3/MinIO.
BACKUP SNAPSHOT demo_db.snapshot_label
TO YOUR_S3_REPOSITORY
ON (table_name);
Summary
Component | Backup Necessity | Method
FE Metadata | Critical | ALTER SYSTEM CREATE IMAGE + Sync meta/ dir.
BE Metadata | Not Required | Automatically managed and synced by FE.
BE Data | High | Use BACKUP statement or rely on 3x replicas.
Bottom line: Focus your automated scripts on the FE metadata (as you've already started) and use the SQL BACKUP command for long-term data retention of your actual tables.
References
• administration/cluster_snapshot.md
• administration/Meta_recovery.md
• faq/operation_maintenance_faq.md
• administration/management/BE_configuration.md
References
• administration/Meta_recovery.md