- About DM
- DM Overview
- DM 5.3 Release Notes
- Basic Features
- Advanced Features
- Merge and Migrate Data from Sharded Tables
- Migrate from MySQL Databases that Use GH-ost/PT-osc
- Filter Certain Row Changes Using SQL Expressions
- DM Architecture
- Quick Start
- Cluster Upgrade
- Manage Data Source
- Manage a Data Migration Task
- Manually Handle Sharding DDL Lock
- Manage Schemas of Tables to be Migrated
- Handle Alerts
- Daily Check
- Usage Scenarios
- Performance Tuning
- Release Notes
DM-worker is a tool used to migrate data from MySQL/MariaDB to TiDB.
It has the following features:
- Acts as a secondary database of any MySQL or MariaDB instance
- Reads the binlog events from MySQL/MariaDB and persists them to the local storage
- A single DM-worker supports migrating the data of one MySQL/MariaDB instance to multiple TiDB instances
- Multiple DM-workers support migrating the data of multiple MySQL/MariaDB instances to one TiDB instance
A DM-worker task contains multiple logic units, including relay log, the dump processing unit, the load processing unit, and binlog replication.
The relay log persistently stores the binlog data from the upstream MySQL/MariaDB and provides the feature of accessing binlog events for the binlog replication.
Its rationale and features are similar to the relay log of MySQL. For details, see MySQL Relay Log.
The dump processing unit dumps the full data from the upstream MySQL/MariaDB to the local disk.
The load processing unit reads the dumped files of the dump processing unit and then loads these files to the downstream TiDB.
Binlog replication/sync processing unit reads the binlog events of the upstream MySQL/MariaDB or the binlog events of the relay log, transforms these events to SQL statements, and then applies these statements to the downstream TiDB.
This section describes the upstream and downstream database users' privileges required by DM-worker, and the user privileges required by the respective processing unit.
The upstream database (MySQL/MariaDB) user must have the following privileges:
If you need to migrate the data from
db1 to TiDB, execute the following
GRANT RELOAD,REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'your_user'@'your_wildcard_of_host' GRANT SELECT ON db1.* TO 'your_user'@'your_wildcard_of_host';
If you also need to migrate the data from other databases into TiDB, make sure the same privileges are granted to the user of the respective databases.
The downstream database (TiDB) user must have the following privileges:
Execute the following
GRANT statement for the databases or tables that you need to migrate:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX ON db.table TO 'your_user'@'your_wildcard_of_host';
|Processing unit||Minimal upstream (MySQL/MariaDB) privilege||Minimal downstream (TiDB) privilege||Minimal system privilege|
|Relay log||NULL||Read/Write local files|
|Dump||NULL||Write local files|
|Load||NULL||Read/Write local files|
|Binlog replication||Read/Write local files|
These privileges are not immutable and they change as the request changes.