- Docs Home
- About TiDB Cloud
- Get Started
- Develop Applications
- Overview
- Quick Start
- Build a TiDB Developer Cluster
- CRUD SQL in TiDB
- Build a Simple CRUD App with TiDB
- Example Applications
- Connect to TiDB
- Design Database Schema
- Write Data
- Read Data
- Transaction
- Optimize
- Troubleshoot
- Reference
- Cloud Native Development Environment
- Manage Cluster
- Plan Your Cluster
- Create a TiDB Cluster
- Connect to Your TiDB Cluster
- Set Up VPC Peering Connections
- Use an HTAP Cluster with TiFlash
- Scale a TiDB Cluster
- Upgrade a TiDB Cluster
- Delete a TiDB Cluster
- Use TiDB Cloud API (Beta)
- Migrate Data
- Import Sample Data
- Migrate Data into TiDB
- Configure Amazon S3 Access and GCS Access
- Migrate from MySQL-Compatible Databases
- Migrate Incremental Data from MySQL-Compatible Databases
- Migrate from Amazon Aurora MySQL in Bulk
- Import or Migrate from Amazon S3 or GCS to TiDB Cloud
- Import CSV Files from Amazon S3 or GCS into TiDB Cloud
- Import Apache Parquet Files from Amazon S3 or GCS into TiDB Cloud
- Troubleshoot Access Denied Errors during Data Import from Amazon S3
- Export Data from TiDB
- Back Up and Restore
- Monitor and Alert
- Overview
- Built-in Monitoring
- Built-in Alerting
- Third-Party Monitoring Integrations
- Tune Performance
- Overview
- Analyze Performance
- SQL Tuning
- Overview
- Understanding the Query Execution Plan
- SQL Optimization Process
- Overview
- Logic Optimization
- Physical Optimization
- Prepare Execution Plan Cache
- Control Execution Plans
- TiKV Follower Read
- Coprocessor Cache
- Garbage Collection (GC)
- Tune TiFlash performance
- Manage User Access
- Billing
- Reference
- TiDB Cluster Architecture
- TiDB Cloud Cluster Limits and Quotas
- TiDB Limitations
- SQL
- Explore SQL with TiDB
- SQL Language Structure and Syntax
- SQL Statements
ADD COLUMNADD INDEXADMINADMIN CANCEL DDLADMIN CHECKSUM TABLEADMIN CHECK [TABLE|INDEX]ADMIN SHOW DDL [JOBS|QUERIES]ALTER DATABASEALTER INDEXALTER TABLEALTER TABLE COMPACTALTER USERANALYZE TABLEBATCHBEGINCHANGE COLUMNCOMMITCHANGE DRAINERCHANGE PUMPCREATE [GLOBAL|SESSION] BINDINGCREATE DATABASECREATE INDEXCREATE ROLECREATE SEQUENCECREATE TABLE LIKECREATE TABLECREATE USERCREATE VIEWDEALLOCATEDELETEDESCDESCRIBEDODROP [GLOBAL|SESSION] BINDINGDROP COLUMNDROP DATABASEDROP INDEXDROP ROLEDROP SEQUENCEDROP STATSDROP TABLEDROP USERDROP VIEWEXECUTEEXPLAIN ANALYZEEXPLAINFLASHBACK TABLEFLUSH PRIVILEGESFLUSH STATUSFLUSH TABLESGRANT <privileges>GRANT <role>INSERTKILL [TIDB]MODIFY COLUMNPREPARERECOVER TABLERENAME INDEXRENAME TABLEREPLACEREVOKE <privileges>REVOKE <role>ROLLBACKSELECTSET DEFAULT ROLESET [NAMES|CHARACTER SET]SET PASSWORDSET ROLESET TRANSACTIONSET [GLOBAL|SESSION] <variable>SHOW ANALYZE STATUSSHOW [GLOBAL|SESSION] BINDINGSSHOW BUILTINSSHOW CHARACTER SETSHOW COLLATIONSHOW [FULL] COLUMNS FROMSHOW CREATE SEQUENCESHOW CREATE TABLESHOW CREATE USERSHOW DATABASESSHOW DRAINER STATUSSHOW ENGINESSHOW ERRORSSHOW [FULL] FIELDS FROMSHOW GRANTSSHOW INDEX [FROM|IN]SHOW INDEXES [FROM|IN]SHOW KEYS [FROM|IN]SHOW MASTER STATUSSHOW PLUGINSSHOW PRIVILEGESSHOW [FULL] PROCESSSLISTSHOW PROFILESSHOW PUMP STATUSSHOW SCHEMASSHOW STATS_HEALTHYSHOW STATS_HISTOGRAMSSHOW STATS_METASHOW STATUSSHOW TABLE NEXT_ROW_IDSHOW TABLE REGIONSSHOW TABLE STATUSSHOW [FULL] TABLESSHOW [GLOBAL|SESSION] VARIABLESSHOW WARNINGSSHUTDOWNSPLIT REGIONSTART TRANSACTIONTABLETRACETRUNCATEUPDATEUSEWITH
- Data Types
- Functions and Operators
- Overview
- Type Conversion in Expression Evaluation
- Operators
- Control Flow Functions
- String Functions
- Numeric Functions and Operators
- Date and Time Functions
- Bit Functions and Operators
- Cast Functions and Operators
- Encryption and Compression Functions
- Locking Functions
- Information Functions
- JSON Functions
- Aggregate (GROUP BY) Functions
- Window Functions
- Miscellaneous Functions
- Precision Math
- Set Operations
- List of Expressions for Pushdown
- TiDB Specific Functions
- Clustered Indexes
- Constraints
- Generated Columns
- SQL Mode
- Table Attributes
- Transactions
- Views
- Partitioning
- Temporary Tables
- Cached Tables
- Character Set and Collation
- Read Historical Data
- System Tables
mysql- INFORMATION_SCHEMA
- Overview
ANALYZE_STATUSCLIENT_ERRORS_SUMMARY_BY_HOSTCLIENT_ERRORS_SUMMARY_BY_USERCLIENT_ERRORS_SUMMARY_GLOBALCHARACTER_SETSCLUSTER_INFOCOLLATIONSCOLLATION_CHARACTER_SET_APPLICABILITYCOLUMNSDATA_LOCK_WAITSDDL_JOBSDEADLOCKSENGINESKEY_COLUMN_USAGEPARTITIONSPROCESSLISTREFERENTIAL_CONSTRAINTSSCHEMATASEQUENCESSESSION_VARIABLESSLOW_QUERYSTATISTICSTABLESTABLE_CONSTRAINTSTABLE_STORAGE_STATSTIDB_HOT_REGIONS_HISTORYTIDB_INDEXESTIDB_SERVERS_INFOTIDB_TRXTIFLASH_REPLICATIKV_REGION_PEERSTIKV_REGION_STATUSTIKV_STORE_STATUSUSER_PRIVILEGESVIEWS
- System Variables
- API Reference
- Storage Engines
- Dumpling
- Table Filter
- Troubleshoot Inconsistency Between Data and Indexes
- FAQs
- Release Notes
- Support
- Glossary
Migrate from Amazon Aurora MySQL to TiDB Cloud in Bulk
This document describes how to migrate data from Amazon Aurora MySQL to TiDB Cloud in bulk using the import tools on TiDB Cloud console.
Learn how to create an import task on the TiDB Cloud console
To import data, perform the following steps:
Navigate to the Clusters page.
Find the area of your target cluster and click Import Data in the upper-right corner of the area. The Data Import Task page is displayed.
TipAlternatively, you can also click the name of your target cluster on the Clusters page and click Import Data in the upper-right corner.
Prepare source data according to Learn how to create an Amazon S3 Bucket and prepare source data files. You can see the advantages and disadvantages of different Data Format in the preparing data part.
Fill in the Data Source Type, Bucket URL, and Data Format fields according to the specification of your source data.
Fill in the Username and Password fields of the Target Cluster.
Create the bucket policy and role for cross-account access according to Learn how to configure cross-account access.
Click Import.
A warning message about the database resource consumption is displayed.
Click Confirm.
TiDB Cloud starts validating whether it can access your data in the specified bucket URL. After the validation is completed and successful, the import task starts automatically. If you get the
AccessDeniederror, see Troubleshoot Access Denied Errors during Data Import from S3.
If your task fails, refer to Learn how to clean up incomplete data.
Learn how to create an Amazon S3 Bucket and prepare source data files
To prepare data, you can select one from the following two options:
Option 1: Prepare source data files using Dumpling
You need to launch Dumpling on your EC2, and export the data to Amazon S3. The data you export is the current latest data of your source database. This might affect the online service. Dumpling will lock the table when you export data.
Option 2: Prepare source data files using Amazon Aurora snapshots
This affects your online service. It might take a while when you export data, because the export task on Amazon Aurora first restores and scales the database before exporting data to Amazon S3. For more details, see Exporting DB snapshot data to Amazon S3.
Prechecks and preparations
Currently, it is not recommended to import more than 2 TB of data.
Before starting the migration, you need to do the following prechecks and preparations.
Ensure enough free space
Ensure that the free space of your TiDB cluster is larger than the size of your data. It is recommended that you should reserve 600 GB free space on each TiKV node. You can add more TiKV nodes to fulfill your demand.
Check the database’s collation set settings
Currently, TiDB only supports the utf8_general_ci and utf8mb4_general_ci collation. To verify the collation settings of your database, execute the following command in the MySQL terminal connected to Aurora:
select * from ((select table_schema, table_name, column_name, collation_name from information_schema.columns where character_set_name is not null) union all (select table_schema, table_name, null, table_collation from information_schema.tables)) x where table_schema not in ('performance_schema', 'mysql', 'information_schema') and collation_name not in ('utf8_bin', 'utf8mb4_bin', 'ascii_bin', 'latin1_bin', 'binary', 'utf8_general_ci', 'utf8mb4_general_ci');
The result is as follows:
Empty set (0.04 sec)
If TiDB does not support your character set or collation, consider converting them to supported types. For more details, see Character Set and Collation.
Option 1: Prepare source data files using Dumpling
You need to prepare an EC2 to run the following data export task. It's better to run on the same network with Aurora and S3 to avoid extra fees.
Install Dumpling on EC2.
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh source ~/.bash_profile tiup install dumplingIn the above commands, you need to modify
~/.bash_profileto the path of your profile file.Grant the write privilege to Dumpling for writing S3.
NoteIf you have assigned the IAM role to the EC2, you can skip configuring the access key and security key, and directly run Dumpling on this EC2.
You can grant the write privilege using the access key and security key of your AWS account in the environment. Create a specific key pair for preparing data, and revoke the access key immediately after you finish the preparation.
export AWS_ACCESS_KEY_ID=AccessKeyID export AWS_SECRET_ACCESS_KEY=SecretKeyBack up the source database to S3.
Use Dumpling to export the data from Amazon Aurora. Based on your environment, replace the content in angle brackets (>), and then execute the following commands. If you want to use filter rules when exporting the data, refer to Table Filter.
export_username="<Aurora username>" export_password="<Aurora password>" export_endpoint="<the endpoint for Amazon Aurora MySQL>" # You will use the s3 url when you create importing task backup_dir="s3://<bucket name>/<backup dir>" s3_bucket_region="<bueckt_region>" # Use `tiup -- dumpling` instead if "flag needs an argument: 'h' in -h" is prompted for TiUP versions earlier than v1.8 tiup dumpling \ -u "$export_username" \ -p "$export_password" \ -P 3306 \ -h "$export_endpoint" \ --filetype sql \ --threads 8 \ -o "$backup_dir" \ --consistency="none" \ --s3.region="$s3_bucket_region" \ -r 200000 \ -F 256MiBOn the data import task panel of TiDB Cloud, choose TiDB Dumpling as the Data Format.
Option 2: Prepare source data files using Amazon Aurora snapshots
Back up the schema of the database and restore on TiDB Cloud
To migrate data from Aurora, you need to back up the schema of the database.
Install the MySQL client.
yum install mysql -yBack up the schema of the database.
export_username="<Aurora username>" export_endpoint="<Aurora endpoint>" export_database="<Database to export>" mysqldump -h ${export_endpoint} -u ${export_username} -p --ssl-mode=DISABLED -d${export_database} >db.sqlImport the schema of the database into TiDB Cloud.
dest_endpoint="<TiDB Cloud connect endpoint>" dest_username="<TiDB Cloud username>" dest_database="<Database to restore>" mysql -u ${dest_username} -h ${dest_endpoint} -P ${dest_port_number} -p -D${dest_database}<db.sqlOn the data import task panel of TiDB Cloud, choose Aurora Backup Snapshot as the Data Format.
Take a snapshot and export it to S3
From the Amazon RDS console, choose Snapshots, and click Take snapshots to create a manual snapshot.
Fill in the blank under Snapshot Name. Click Take snapshot. When you finish creating the snapshot, the snapshot shows under the snapshot table.
Choose the snapshot you have taken, click Actions. In the drop-down box, click Export to Amazon S3.
Fill the blank under Export identifier.
Choose the amount of data to be exported. In this guide, All is selected. You can also choose partial to use identifiers to decide which part of the database needs to be exported.
Choose the S3 bucket to store the snapshot. You can create a new bucket to store the data for security concerns. It is recommended to use the bucket in the same region as your TiDB cluster. Downloading data across regions can cause additional network costs.
Choose the proper IAM role to grant write access to the S3 bucket. Make a note of this role as it will be used later when you import the snapshot to TiDB Cloud.
Choose a proper AWS KMS Key and make sure the IAM role has already been added to the KMS Key Users. To add a role, you can select a KSM service, select the key, and then click Add.
Click Export Amazon S3. You can see the progress in the task table.
From the task table, record the destination bucket (for example,
s3://snapshot-bucket/snapshot-samples-1).
Learn how to configure cross-account access
The TiDB Cloud cluster and the S3 bucket are in different AWS accounts. To allow the TiDB Cloud cluster to access the source data files in the S3 bucket, you need to configure the cross-account access to Amazon S3. For more information, see Configure Amazon S3 access.
Once finished, you will have created a policy and role for cross-account. You can then continue with the configuration on the data import task panel of TiDB Cloud.
Learn how to set up filter rules
Refer to the Table Filter document.
Learn how to clean up incomplete data
You can check the requirements again. When all the problems are solved, you can drop the incomplete database and restart the importing process.
- Learn how to create an import task on the TiDB Cloud console
- Learn how to create an Amazon S3 Bucket and prepare source data files
- Learn how to configure cross-account access
- Learn how to set up filter rules
- Learn how to clean up incomplete data