How to logically export TiDB to a CSV file and back it up to S3

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb如何逻辑导出成csv文件备份到s3

| username: 芮芮是产品

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed that caused the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
Can mysqldump export SQL to SQL and then put it on S3?
Is there a similar tool or built-in command in TiDB?
I want to do a backup. Is logical backup or physical backup recommended?

| username: 啦啦啦啦啦 | Original post link

mysqldump can’t directly export to S3, but you can use dumpling to export as CSV and push to S3 with the -o parameter.
As for logical backup or physical backup, it depends on the size of your data. If the data volume is large, use BR; if it’s small, use dumpling.

| username: 小龙虾爱大龙虾 | Original post link

The dumpling tool can export to SQL or CSV and natively supports S3 storage. The BR tool can also perform backups, but the BR backup output is in SST files, which are not human-readable. It also supports backup to S3. It is recommended to use the dumpling tool for small data volumes, as it provides logical backups that are readable. For large data volumes, use BR for backups, as it is much more efficient than dumpling.

| username: ShawnYan | Original post link

Please refer to the Dumpling official documentation:

| username: heiwandou | Original post link

Try exporting with SQL*Loader.

| username: 像风一样的男子 | Original post link

If you need to schedule regular database backups, it is recommended to use BR for backups.

| username: 春风十里 | Original post link

Using the data export tool Dumpling, you can export data stored in TiDB or MySQL into SQL or CSV formats for logical full backups. Dumpling also supports exporting data to Amazon S3.

Backups include logical backups (dumpling) and physical backups (br). Logical backups export a bunch of SQL-related files and cannot perform incremental recovery, while physical backups can perform incremental recovery. Logical backups are relatively flexible but slower, whereas br is considered hot backup and generally faster for full database backups in larger databases compared to dumpling.

| username: Jolyne | Original post link

If you want to perform a backup, it is recommended to choose tools (dumpling and br) based on the data volume.

| username: 随缘天空 | Original post link

You can refer to the following link: 备份存储 | PingCAP 文档中心

| username: 普罗米修斯 | Original post link

The data export tool Dumpling supports exporting CSV to S3.

| username: andone | Original post link

It is recommended to use the dumpling tool. It’s like an upgraded version of mysqldumper.

| username: zhanggame1 | Original post link

Dumpling can export CSV to S3.
Dumpling can also add WHERE conditions or export MVCC data without GC.

| username: Jellybean | Original post link

If you need to back up, you can use the BR physical backup tool or the logical backup tool dumpling.

If the data volume is not large, for example, if the table has less than ten million rows, you can consider logical backup; if the data volume is very large, with hundreds of millions of rows or TB level, it is recommended to use physical backup.

| username: dba远航 | Original post link

The dumpling tool can export to SQL or CSV and natively supports S3 storage, which is a logical backup. The br tool can also perform backups, but the br backup is in SST files, which are not human-readable. It also supports backup to S3 and is considered a physical backup.