When migrating a database to Aiven, sometimes you may encounter errors like this:

{
"migration": {
"error": "Migration process failed",
"method": "",
"seconds_behind_master": null,
"source_active": true,
"status": "done"
},
"migration_detail": []
}
-----Response End-----
STATUS METHOD ERROR
====== ====== ========================
done Migration process failed

In order to avoid these types of failures during the migration process we recommend that you run a check in advance.

Either the AVN CLI or Aiven REST API will be needed to run the task. Let's take a MySQL migration check as an example, other types of DB will be similar.

AVN CLI

Step 1: Create a task to perform the migration check

Here, we demonstrate a migration check from a MySQL DB to an Aiven service (project: example, service: mysql):

avn service task-create --operation migration_check --source-service-uri mysql://user:password@hostname:port/databasename --project example mysql

TASK_TYPE SUCCESS TASK_ID
===================== ======= ====================================
mysql_migration_check null e2df7736-66c5-4696-b6c9-d33a0fc4cbed

You can find more options available via the -h menu, for example, to ignore certain databases for the check. Please note that filter databases are supported by MySQL only at the moment.

Step 2: Retrieve your task's status

Check the status of your task to see if it was successful or to show any error details:

avn service task-get --task-id e2df7736-66c5-4696-b6c9-d33a0fc4cbed --project example mysql

TASK_TYPE SUCCESS TASK_ID RESULT
===================== ======= ==================================== ====================================================================================
mysql_migration_check true e2df7736-66c5-4696-b6c9-d33a0fc4cbed All pre-checks passed successfully, preferred migration method will be [Replication]

Aiven REST API

The same checks can be performed via the REST API. The relevant endpoints are listed below:

https://api.aiven.io/doc/#operation/ServiceTaskCreate
https://api.aiven.io/doc/#operation/ServiceTaskGet

More details can be found here:

https://api.aiven.io/doc/#operation/ServiceTaskCreate

https://api.aiven.io/doc/#operation/ServiceTaskGet

If you have any questions, please feel free to reach out to our Support and let us know.

Did this answer your question?