LAS provides the LAS Catalog metadata backup and recovery tool lf-exporter, which you can use to perform same-region and cross-region disaster recovery for metadata (catalog, database, table, partition, function). This document introduces the key points for using the lf-exporter tool and recommendations for disaster recovery solutions.
The LAS Catalog metadata backup and recovery tool lf-exporter runs as an VolcanoEngineEMR Serverless Spark job. After obtaining the toolkit, configure the YAML configuration file and submit an EMR Serverless Spark job to invoke the lf-exporter tool, enabling LAS Catalog metadata backup and recovery.
In the YAML configuration file, the mode parameter specifies the operation mode for LAS Catalog metadata backup and recovery, supporting backup and recovery of metadata in the following four scenarios.
mode | Semantics | Typical use case |
|---|---|---|
| Read metadata from LAS Catalog and back it up to TOS (in JSON format). For details, see the reference documentation below: Reference: Configuration parameter list. | Daily backup and cross-region disaster recovery (backup side) |
| Restore metadata from TOS backup to LAS Catalog. By default, the recovery uses the idempotent strategy of "skip if exists", which is suitable for repeated execution and failure retries. | Same-region / cross-region metadata recovery, disaster recovery drills |
| Import directly from LAS Catalog to Hive Metastore | Synchronize or migrate Catalog metadata from LAS to Hive |
| Restore metadata from TOS backup to Hive Metastore | Scenarios where backup is performed first, then restored to Hive |
When using the lf-exporter tool, after completing the necessary preparations, the general workflow for each scenario is: configure the YAML configuration file > run the EMR Serverless job to invoke the tool > verify the results.
The following section provides detailed instructions for using the lf-exporter tool in different scenarios.
Dependent products | Preparation | Operation guide |
|---|---|---|
EMR Serverless queue | The LAS Catalog metadata backup and recovery tool | |
TOS | When using the | |
IAM | When using the
|
lf-exporter tool lf-exporter tool You need to first obtain the lf-exporter tool and upload it to TOS, so that it can be selected when running EMR Serverless Spark jobs later.
wget https://lasformation-cn-beijing.tos-cn-beijing.volces.com/las-exporter/application.jar
Prepare the YAML configuration file based on your usage scenario. The following are example YAML configuration files for each scenario.
${AK}, ${SK}, TOS paths, and other related parameters as appropriate for your environment.tip
The endPoint and regionId in the configuration are used to specify the service access point and region. Please refer to Link address to obtain the corresponding values.
The following is an example YAML configuration file for exporting and backing up LAS Catalog metadata to TOS: las_to_tos.yaml.
mode: las_to_tos lasClientInfo: akMode: MANUAL accessKeyId: "${AK}" accessKeySecret: "${SK}" endPoint: thrift://lakeformation.las.cn-beijing.ivolces.com:48869 regionId: cn-beijing # Required for STS mode securityToken: "${STS_SESSION_TOKEN}" identityId: "${ACCOUNT_ID}-${ROLE_ID}" runOptions: includeCatalogPrefixs: [] includeDatabasePrefixs: [] includeTablePrefixs: [] objectTypes: [catalog, database, table, partition, function] permissionDeniedStrategy: skip outputBaseDir: tos://backup-bucket/las_exporter/ auditOutputDir: tos://backup-bucket/las_exporter_audit/
Upload the toolkit and configuration file to the TOS Bucket, so that they can be referenced when submitting and running EMR Serverless Spark jobs later. For details on uploading files to a TOS Bucket, see: Upload files .
Log in and go to the EMR console . On the job management page, submit a Spark JAR job. For detailed instructions on submitting the job, see the EMR official documentation: Submit Spark JAR jobs .
In the job content, configure the job details to invoke the lf-exporter tool. Below is a SparkJar JSON task parameter template. You can refer to this template and modify the parameters as needed based on your actual situation.
{ "JobType": "SparkJar", "VolcanoQueue": null, "StorageMounts": [], "MainClass": "bytedance.olap.las.Exporter", "MainApplicationFile": "tos://las_exporter/application.jar", "Jars": [], "Files": [ "tos://las_exporter/tos_to_las.yaml" ], "PyFiles": null, "Archives": [], "SparkConf": "spark.sql.adaptive.enabled=false,spark.driver.cores=1,spark.driver.memory=4G,spark.executor.cores=2,spark.executor.memory=4G,spark.executor.instances=2,spark.sql.shuffle.partitions=200,serverless.spark.access.key=AKLTN******,serverless.spark.secret.key=TnpBe******", "MainArguments": "tos://las_exporter/tos_to_las.yaml" }
Among them:
lf-exporter tool JAR package after uploading it to the TOS Bucket.outputBaseDir, you can see backup directories partitioned by date, which include JSON files for each object type (for example, catalogs/, databases/, tables/, partitions/, functions/). For details on the organization of the output, see Reference: Organization of backup artifacts below for details.auditOutputDir is configured, an audit summary will also be output to help confirm whether the backup was fully successful.lf-exporter tool, note that the lf-exporter tool currently does not copy data files. To ensure data availability for cross-region disaster recovery, an additional data file replication mechanism is required. Common approaches include cross-region replication of object storage TOS or using directory-level replication tools in a controlled compute environment.Table.sd.location, Partition.sd.location, and Function.resourceUris[].uri in the metadata backup. It is recommended to first extract these location prefixes from the backup JSON, calculate the target prefixes using locationMappings, then perform consistency checks on the target prefixes, and use the check results as a prerequisite for metadata restoration.warning
Special attention is required for Iceberg scenarios: locationMappings only changes the location in the metastore and does not modify the internal absolute paths in Iceberg metadata or manifest files. If the physical files of Iceberg are migrated as a whole, you may also need to perform additional data migration or path rewriting at the Iceberg layer.
For the cold backup scenario across regions, this section provides an example configuration process using TOS cross-region replication.
lf-exporter tool. For the las_to_tos task scenario, configure it to back up LAS Catalog metadata to a TOS Bucket in the same region.When the metadata in the primary service region encounters an exception, you can restore the metadata backed up to TOS to LAS. The core process is as follows.
warning
The LAS Catalog metadata backed up to TOS is serialized as JSON and stored in date-partitioned directories. For details, see Reference: Organization of backup artifacts below. When performing a restore, you must specify the required backup date directory.
lf-exporter tool. Based on the configuration for the tos_to_las task scenario, restore the metadata in the TOS Bucket to the LAS Catalog in the same region.In las_to_tos mode, metadata objects are serialized as JSON and stored in the date-partitioned directories under runOptions.outputBaseDir according to object type. In recovery mode (tos_to_las / tos_to_hive), runOptions.inputBaseDir needs to point to the date directory of a specific backup.
tip
During restore, inputBaseDir must point precisely to a specific backup date directory (for example, .../backup/2026-01-16/), rather than the backup root directory.
The following table lists the parameter descriptions used in the backup configuration.
Configuration block | Parameter | Current code/default value | Applicable mode | Current description |
|---|---|---|---|---|
Top level |
| Required; supports | All | See code validation at |
|
|
| All | Both code fields are retained; use |
|
| Required when | All | AK used to access LAS metadata |
|
| Required when | All | SK used to access LAS metadata |
|
| Must be specified in | All | Session |
|
| Required in | All | Identity routing parameter. Must be provided when using STS temporary credentials, in the format |
|
| Optional | All | Only effective in |
|
| Required | All | LAS service endpoint, format: |
|
| Required | All | Must align with the target Region |
|
| Common default: |
| Commonly used for semi-managed Hive |
|
| Optional |
| Required only for Hive with Kerberos enabled |
|
| Optional |
| Used when connecting directly to HMS |
|
| Optional |
| JDBC is used for Catalog-related writes |
|
| Empty means no filtering | All | Prefix match for catalog |
|
| Empty means no filtering | All | Prefix match for database |
|
| Empty means no filtering | All | Prefix match for table |
|
| Empty means no filtering | All | Prefix match for function; present in historical tables and still supported in code |
|
| Required | All | Supports |
|
| Default: |
| Mainly controls batch writing of partitions |
|
| Default: |
| Affects task splitting granularity |
|
| Required for |
| Export directory; date partitions will be automatically appended |
|
| Required for |
| Points to the backup root directory for a specific day, for example, |
|
| Optional |
| Performs location prefix replacement during restore; |
|
| Default: | All | Supports |
|
| Optional | All | When configured, the audit summary will also be written to TOS |