Installing, Configuring, and Using DTLE for MySQL Data Transfer with Database and Table Renaming
This guide explains how to install the DTLE RPM, prepare MySQL source and target instances, create job JSON files to rename databases or tables during transfer, submit jobs via Nomad, verify synchronization, and clean up jobs, providing a complete end‑to‑end data migration workflow.
DTLE is an open‑source data transfer component that supports various MySQL use‑cases. This guide shows how to install the 3.21.10.1 RPM, start the service, and prepare two MySQL 5.7 instances for source and destination.
After installing, logs are located at /data/dtle/var/log and the service is started with systemctl start dtle-consul dtle-nomad .
Test data is created in the source databases dtle_d1 and dtle_db2 with sample tables and rows.
Job configuration files can be written in JSON (or HCL) and placed under /data/dtle/usr/share/dtle/scripts . Scenario 1 demonstrates copying the whole database dtle_d1 to a new database dtle_d1_new while keeping table names unchanged. The JSON job definition is shown below.
{
"Job": {
"ID": "job1",
"Datacenters": ["dc1"],
"TaskGroups": [
{
"Name": "src",
"Tasks": [{
"Name": "src",
"Driver": "dtle",
"Config": {
"ReplicateDoDb": [{
"TableSchema": "dtle_d1",
"TableSchemaRename": "dtle_d1_new"
}],
"GroupMaxSize": 1024,
"GroupTimeout": 100,
"DropTableIfExists": true,
"Gtid": "",
"ChunkSize": 2000,
"ConnectionConfig": {
"Host": "10.186.65.16",
"Port": 3316,
"User": "root",
"Password": "root"
}
}
}],
"RestartPolicy": {
"Attempts": 3,
"Interval": 600000000000,
"Delay": 15000000000,
"Mode": "delay"
}
},
{
"Name": "dest",
"Tasks": [{
"Name": "dest",
"Driver": "dtle",
"Config": {
"ConnectionConfig": {
"Host": "10.186.65.15",
"Port": 3316,
"User": "root",
"Password": "root"
}
}
}],
"RestartPolicy": {
"Attempts": 3,
"Interval": 600000000000,
"Delay": 15000000000,
"Mode": "delay"
}
}
],
"ReschedulePolicy": {
"Attempts": 1,
"Interval": 1800000000000,
"Unlimited": false
}
}
}The job is submitted via the Nomad HTTP API:
# cd /data/dtle/usr/share/dtle/scripts/
curl -XPOST "http://10.186.65.5:4646/v1/jobs" -d @job1.json -s | jqJob status can be queried with:
# curl -s -XGET 127.0.0.1:4646/v1/jobs | jq '.[].ID'
# curl -s -XGET 127.0.0.1:4646/v1/job/job1 | jq '.Status'Verification shows the destination database dtle_d1_new contains the transferred rows, and incremental inserts are replicated.
Scenario 2 copies a single table dtle_table2 from dtle_db2 to a renamed table dtle_table2_new . The corresponding JSON job file is provided and submitted in the same way. After running, both full load and subsequent updates are synchronized.
To delete a job, use the Nomad API:
# curl -s -XDELETE 10.186.65.5:4646/v1/job/job2?purge=true | jqFor more details, refer to the DTLE user manual at https://actiontech.github.io/dtle-docs-cn/ .
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.