Skip to main content
Version: 1.2

Metadata Export & Import

The snapshot commands save, restore, and inspect GreptimeDB metadata snapshots.

Export Tool

Command Syntax

greptime cli meta snapshot save [OPTIONS]

Options

Storage Backend Options

OptionRequiredDefaultDescription
--store-addrsYes, for persistent backends-Metadata store addresses. Required for persistent backends; the format depends on the backend
--backendNoetcd-storeMetadata store backend: etcd-store, memory-store, postgres-store, mysql-store, or raft-engine-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-pathNometadata_snapshot.metadata.fbPath of the snapshot file
--dirNo/Root directory used for file or object-store I/O

Object Storage Options

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

S3
OptionRequiredDefaultDescription
--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
--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
--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-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage
OptionRequiredDefaultDescription
--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, for persistent backends-Metadata store addresses. Required for persistent backends; the format depends on the backend
--backendNoetcd-storeMetadata store backend: etcd-store, memory-store, postgres-store, mysql-store, or raft-engine-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-pathNometadata_snapshot.metadata.fbPath of the snapshot file to restore
--dirNo/Root directory used for file or object-store I/O
--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
--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
--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
--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-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage
OptionRequiredDefaultDescription
--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-pathNometadata_snapshot.metadata.fbPath of the snapshot file to inspect
--dirNo/Root directory used for file or object-store I/O
--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
--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
--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
--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-credentialNo-GCS credential content
--gcs-endpointNo-GCS endpoint URL
Azure Blob Storage
OptionRequiredDefaultDescription
--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