<@U0A71G31CDV> How can I backup metadata frontend ...
# questions-and-troubleshooting
s
@Rocky How can I backup metadata frontend ?
r
The recommended way to back up StarRocks Frontend (FE) metadata depends on your version and architecture (Shared-nothing vs. Shared-data). 1. Manual Directory Backup (All Versions) StarRocks FE metadata is stored on the local disk of each FE node. The directory is defined by the
meta_dir
parameter in your
fe.conf
(default is
$STARROCKS_HOME/fe/meta
). To perform a clean backup: 1. Trigger a checkpoint: Run the following SQL to force the FE to create a new metadata image (snapshot):
Copy code
sql
   ALTER SYSTEM CREATE IMAGE;
2. Locate the metadata: Go to the
meta
directory on your FE nodes. It contains: * `image/`: The catalog snapshots. * `bdb/`: The Berkeley DB JE logs (journal of changes). 3. Copy the directory: Use
cp -r
,
tar
, or a synchronization tool to back up the entire
meta/
directory to a secure remote location. _ _Note:* For absolute consistency, it is safest to stop the FE before copying, though triggering an image first reduces the risk of data loss if you copy while running. 2. Cluster Snapshots (StarRocks v3.5+) If you are using StarRocks v3.5 or later (especially in Shared-data architecture), you can use the built-in Cluster Snapshot feature. This captures the complete cluster state—including catalogs, databases, tables, users, and permissions—and saves it to object storage (S3, HDFS, etc.). * This method is automated and designed for disaster recovery, allowing you to restore the entire cluster state in minutes. 3. Metadata High Availability (Best Practice) In production, the best way to "back up" live metadata is to ensure high availability: * Multiple Followers: Deploy at least three FE Follower nodes. StarRocks uses the BDBJE protocol to replicate metadata across these nodes automatically. * Adding Nodes: If an FE node fails permanently, you can simply add a new FE node to the cluster. It will automatically synchronize all metadata from the Leader FE. 4. What about the
BACKUP
statement?
The SQL command
BACKUP SNAPSHOT
is primarily used for data (tables and partitions). While it can back up external catalog metadata and UDFs (from v3.4.0+), it does not back up the core FE cluster state (like user accounts, roles, or internal FE configuration). Use the manual directory method or Cluster Snapshots for full frontend metadata protection. References • administration/Meta_recovery.md