Skip to main content
Version: Nightly

Metadata Export & Import

The Export and Import tools provide functionality for backing up and restoring GreptimeDB metadata. These tools allow for metadata backup and restoration operations.

Export Tool​

Command Syntax​

greptime cli meta snapshot save [OPTIONS]

Options​

Storage Backend Options​

OptionRequiredDefaultDescription
--store-addrsYes-Metadata storage service addresses to connect to (only supports etcd MySQL PostgreSQL) format consistent with store-addrs in metasrv configuration
--backendYes-Type of metadata storage backend, one of etcd-store, postgres-store, mysql-store
--store-key-prefixNo""Unified prefix for data in metasrv, refer to metasrv configuration
--meta-table-nameNogreptime_metakvWhen backend is one of postgres-store, mysql-store, the table name storing metadata
--max-txn-opsNo128Maximum number of txn operations

File Options​

OptionRequiredDefaultDescription
--file-nameNometadata_snapshotFile name for metadata export, will automatically add .metadata.fb suffix
--dirNo""Directory to store exported data

Object Storage Options​

To use object storage for storing exported metadata, enable one of the following providers and configure its connection parameters:

S3​
OptionRequiredDefaultDescription
--enable-s3NofalseWhether to use S3 as storage medium for exported data
--s3-bucketNo-S3 bucket name
--s3-rootNo-Root path in S3 bucket
--s3-access-key-idNo-S3 access key ID
--s3-secret-access-keyNo-S3 secret access key
--s3-regionNo-S3 region name
--s3-endpointNo-S3 endpoint URL (optional, defaults based on bucket region)
--s3-enable-virtual-host-styleNofalseEnable virtual host style for S3 API requests
OSS (Alibaba Cloud)​
OptionRequiredDefaultDescription
--enable-ossNofalseWhether to use OSS for exported data
--oss-bucketNo-OSS bucket name
--oss-rootNo-Root path in OSS bucket
--oss-access-key-idNo-OSS access key ID
--oss-access-key-secretNo-OSS access key secret
--oss-endpointNo-OSS endpoint URL
GCS (Google Cloud Storage)​
OptionRequiredDefaultDescription
--enable-gcsNofalseWhether to use GCS for exported data
--gcs-bucketNo-GCS bucket name
--gcs-rootNo-Root path in GCS bucket
--gcs-scopeNo-GCS service scope
--gcs-credential-pathNo-Path to GCS credential file
--gcs-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage​
OptionRequiredDefaultDescription
--enable-azblobNofalseWhether to use Azure Blob for exported data
--azblob-containerNo-Azure Blob container name
--azblob-rootNo-Root path in container
--azblob-account-nameNo-Azure Blob account name
--azblob-account-keyNo-Azure Blob account key
--azblob-endpointNo-Azure Blob endpoint URL
--azblob-sas-tokenNo-Azure Blob SAS token

Import Tool​

Command Syntax​

greptime cli meta snapshot restore [OPTIONS]

Options​

Storage Backend Options​

OptionRequiredDefaultDescription
--store-addrsYes-Metadata storage service addresses to connect to (only supports etcd MySQL PostgreSQL) format consistent with store-addrs in metasrv configuration
--backendYes-Type of metadata storage backend, one of etcd-store, postgres-store, mysql-store
--store-key-prefixNo""Unified prefix for data in metasrv, refer to metasrv configuration
--meta-table-nameNogreptime_metakvWhen backend is postgres-store, mysql-store, the table name storing metadata
--max-txn-opsNo128Maximum number of txn operations

File Options​

OptionRequiredDefaultDescription
--file-nameNometadata_snapshot.metadata.fbFile name of metadata export to import
--dirNo"."Directory storing exported data
--forceNofalseWhether to force import, when target backend is detected to not be in a clean state, import is disabled by default, enable this flag to force import

Object Storage Options​

To use object storage for importing metadata, enable one of the following providers and configure its connection parameters:

S3​
OptionRequiredDefaultDescription
--enable-s3NofalseWhether to use S3 as storage medium for exported data
--s3-bucketNo-S3 bucket name
--s3-rootNo-Root path in S3 bucket
--s3-access-key-idNo-S3 access key ID
--s3-secret-access-keyNo-S3 secret access key
--s3-regionNo-S3 region name
--s3-endpointNo-S3 endpoint URL (optional, defaults based on bucket region)
--s3-enable-virtual-host-styleNofalseEnable virtual host style for S3 API requests
OSS (Alibaba Cloud)​
OptionRequiredDefaultDescription
--enable-ossNofalseWhether to use OSS for exported data
--oss-bucketNo-OSS bucket name
--oss-rootNo-Root path in OSS bucket
--oss-access-key-idNo-OSS access key ID
--oss-access-key-secretNo-OSS access key secret
--oss-endpointNo-OSS endpoint URL
GCS (Google Cloud Storage)​
OptionRequiredDefaultDescription
--enable-gcsNofalseWhether to use GCS for exported data
--gcs-bucketNo-GCS bucket name
--gcs-rootNo-Root path in GCS bucket
--gcs-scopeNo-GCS service scope
--gcs-credential-pathNo-Path to GCS credential file
--gcs-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage​
OptionRequiredDefaultDescription
--enable-azblobNofalseWhether to use Azure Blob for exported data
--azblob-containerNo-Azure Blob container name
--azblob-rootNo-Root path in container
--azblob-account-nameNo-Azure Blob account name
--azblob-account-keyNo-Azure Blob account key
--azblob-endpointNo-Azure Blob endpoint URL
--azblob-sas-tokenNo-Azure Blob SAS token

Info Tool​

The Info tool allows you to view the contents of a metadata snapshot without restoring it.

Command Syntax​

greptime cli meta snapshot info [OPTIONS]

Options​

File Options​

OptionRequiredDefaultDescription
--file-nameNometadata_snapshotFile name of the metadata snapshot to view
--dirNo"."Directory where the snapshot file is stored
--inspect-keyNo"*"Query pattern to filter metadata keys
--limitNo-Maximum number of entries to display

Object Storage Options​

To inspect snapshots stored in object storage, enable one of the following providers and configure its connection parameters:

S3​
OptionRequiredDefaultDescription
--enable-s3NofalseWhether to use S3 as storage medium for the snapshot
--s3-bucketNo-S3 bucket name
--s3-rootNo-Root path in S3 bucket
--s3-access-key-idNo-S3 access key ID
--s3-secret-access-keyNo-S3 secret access key
--s3-regionNo-S3 region name
--s3-endpointNo-S3 endpoint URL (optional, defaults based on bucket region)
--s3-enable-virtual-host-styleNofalseEnable virtual host style for S3 API requests
OSS (Alibaba Cloud)​
OptionRequiredDefaultDescription
--enable-ossNofalseWhether to use OSS for the snapshot
--oss-bucketNo-OSS bucket name
--oss-rootNo-Root path in OSS bucket
--oss-access-key-idNo-OSS access key ID
--oss-access-key-secretNo-OSS access key secret
--oss-endpointNo-OSS endpoint URL
GCS (Google Cloud Storage)​
OptionRequiredDefaultDescription
--enable-gcsNofalseWhether to use GCS for the snapshot
--gcs-bucketNo-GCS bucket name
--gcs-rootNo-Root path in GCS bucket
--gcs-scopeNo-GCS service scope
--gcs-credential-pathNo-Path to GCS credential file
--gcs-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage​
OptionRequiredDefaultDescription
--enable-azblobNofalseWhether to use Azure Blob for the snapshot
--azblob-containerNo-Azure Blob container name
--azblob-rootNo-Root path in container
--azblob-account-nameNo-Azure Blob account name
--azblob-account-keyNo-Azure Blob account key
--azblob-endpointNo-Azure Blob endpoint URL
--azblob-sas-tokenNo-Azure Blob SAS token