Export Data from TiDB Cloud Premium
TiDB Cloud enables you to export data from a TiDB Cloud Premium instance to an external storage service. You can use the exported data for backup, migration, data analysis, or other purposes.
While you can also export data using tools such as mysqldump and TiDB Dumpling, the export feature provided by TiDB Cloud offers a more convenient and efficient way to export data from a TiDB Cloud Premium instance. It brings the following benefits:
- Convenience: the export service provides a simple and easy-to-use way to export data from a TiDB Cloud Premium instance, eliminating the need for additional tools or resources.
- Isolation: the export service uses separate computing resources, ensuring isolation from the resources used by your online services.
- Consistency: the export service ensures the consistency of the exported data without causing locks, which does not affect your online services.
Export locations
You can export data to the following external storage locations:
Amazon S3
To export data to Amazon S3, you need to provide the following information:
- URI:
s3://<bucket-name>/<folder-path>/ - One of the following access credentials:
- An access key: make sure the access key has the
s3:PutObjectpermission. - A role ARN: make sure the role ARN (Amazon Resource Name) has the
s3:PutObjectpermission. Note that only TiDB Cloud Premium instances hosted on AWS support the role ARN.
- An access key: make sure the access key has the
For more information, see Configure External Storage Access.
Azure Blob Storage
To export data to Azure Blob Storage, you need to provide the following information:
- URI:
azure://<account-name>.blob.core.windows.net/<container-name>/<folder-path>/orhttps://<account-name>.blob.core.windows.net/<container-name>/<folder-path>/ - Access credential: a shared access signature (SAS) token for your Azure Blob Storage container. Make sure the SAS token has the
ReadandWritepermissions on theContainerandObjectresources.
For more information, see Configure External Storage Access.
Alibaba Cloud OSS
To export data to Alibaba Cloud OSS, you need to provide the following information:
- URI:
oss://<bucket-name>/<folder-path>/ - Access credential: an AccessKey pair for your Alibaba Cloud account. Make sure the AccessKey pair has the
oss:PutObjectandoss:GetBucketInfopermissions.
For more information, see Configure External Storage Access.
Export options
Data filtering
TiDB Cloud console supports exporting data with the selected databases and tables.
Data formats
You can export data in the following formats:
SQL: export data in SQL format.CSV: export data in CSV format. You can specify the following options:delimiter: specify the delimiter used in the exported data. The default delimiter is".separator: specify the character used to separate fields in the exported data. The default separator is,.header: specify whether to include a header row in the exported data. The default value istrue.null-value: specify the string that represents a NULL value in the exported data. The default value is\N.
The schema and data are exported according to the following naming conventions:
Data compression
You can compress the exported CSV and SQL data using the following algorithms:
gzip(default): compress the exported data withgzip.snappy: compress the exported data withsnappy.zstd: compress the exported data withzstd.none: do not compress the exported data.
Examples
Export data to Amazon S3
Log in to the TiDB Cloud console and navigate to the TiDB Instances page.
Click the name of your target TiDB Cloud Premium instance to go to its overview page, and then click Data > Export in the left navigation pane.
On the Export page, click Export Data in the upper-right corner. Then configure the following settings:
- Task Name: enter a name for the export task. The default value is
SNAPSHOT_{snapshot_time}. - Source Connection: enter Username and Password of your TiDB Cloud Premium instance, and then click Test Connection to verify the credentials.
- Target Connection:
- Storage Provider: choose Amazon S3.
- Folder URI: enter the URI of the Amazon S3 with the
s3://<bucket-name>/<folder-path>/format. - Bucket Access: choose one of the following access credentials and then fill in the credential information:
- AWS Role ARN: enter the role ARN that has the permission to access the bucket. It is recommended to create the role ARN with AWS CloudFormation. For more information, see Configure External Storage Access.
- AWS Access Key: enter the access key ID and access key secret that have the permission to access the bucket.
- Exported Data: choose the databases or tables you want to export.
- Data Format: choose SQL or CSV.
- Compression: choose Gzip, Snappy, Zstd, or None.
- Task Name: enter a name for the export task. The default value is
Click Export.
Export data to Azure Blob Storage
Log in to the TiDB Cloud console and navigate to the TiDB Instances page.
Click the name of your target TiDB Cloud Premium instance to go to its overview page, and then click Data > Export in the left navigation pane.
On the Export page, click Export Data in the upper-right corner. Then configure the following settings:
- Task Name: enter a name for the export task. The default value is
SNAPSHOT_{snapshot_time}. - Source Connection: enter Username and Password of your TiDB Cloud Premium instance, and then click Test Connection to verify the credentials.
- Target Connection:
- Storage Provider: choose Azure Blob Storage.
- Folder URI: enter the URI of Azure Blob Storage with the
azure://<account-name>.blob.core.windows.net/<container-name>/<folder-path>/format. - SAS Token: enter the SAS token that has the permission to access the container. It is recommended to create a SAS token with the Azure ARM template. For more information, see Configure External Storage Access.
- Exported Data: choose the databases or tables you want to export.
- Data Format: choose SQL or CSV.
- Compression: choose Gzip, Snappy, Zstd, or None.
- Task Name: enter a name for the export task. The default value is
Click Export.
Export data to Alibaba Cloud OSS
Log in to the TiDB Cloud console and navigate to the TiDB Instances page.
Click the name of your target TiDB Cloud Premium instance to go to its overview page, and then click Data > Export in the left navigation pane.
On the Export page, click Export Data in the upper-right corner:
- Task Name: enter a name for the export task. The default value is
SNAPSHOT_{snapshot_time}. - Source Connection: enter Username and Password of your TiDB Cloud Premium instance, and then click Test Connection to verify the credentials.
- Target Connection:
- Storage Provider: choose Alibaba Cloud OSS.
- Folder URI: enter the Alibaba Cloud OSS URI where you want to export the data, in the
oss://<bucket-name>/<folder-path>/format. - AccessKey ID and AccessKey Secret: enter the AccessKey ID and AccessKey Secret that have the permission to access the bucket.
- Exported Data: choose the databases or tables you want to export.
- Data Format: choose SQL or CSV.
- Compression: choose Gzip, Snappy, Zstd, or None.
- Task Name: enter a name for the export task. The default value is
Click Export.
Cancel an export task
To cancel an ongoing export task, take the following steps:
Log in to the TiDB Cloud console and navigate to the TiDB Instances page.
Click the name of your target TiDB Cloud Premium instance to go to its overview page, and then click Data > Export in the left navigation pane.
On the Export page, view the export task list.
Choose the export task you want to cancel, and then click Action.
Choose Cancel in the drop-down list. Note that you can only cancel the export task that is in the Running status.