Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/vale/styles/config/vocabularies/Aiven/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ Mezmo
MirrorMaker
MongoDB
multicast
mydumper
myhoard
myhoard
myloader
MySQL
mysqldump
mysqlsh
Expand Down Expand Up @@ -360,6 +361,8 @@ upsert
URIs?
UUIDs?
Valkey
vCPU
vCPUs
vectorizing
virtualized
VMs?
Expand Down
14 changes: 12 additions & 2 deletions docs/platform/concepts/service_backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: Service backups
import ConsoleLabel from "@site/src/components/ConsoleIcons";
import AutoDelete from "@site/static/includes/auto-delete-poweredoff.md";
import EditBackUpSchedule from "@site/static/includes/edit-backup-schedule.md";
import EarlyBadge from "@site/src/components/Badges/EarlyBadge";
import Variables from "@site/static/variables.json";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Expand All @@ -30,8 +31,11 @@ backups with the appropriate tooling:

- [PostgreSQL®](https://www.postgresql.org/docs/current/app-pgdump.html):
`pgdump`
- [MySQL®](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html):
`mysqldump`
- [MySQL®](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)

- `mysqldump` for small or medium-sized databases
- [`mydumper`](https://github.com/mydumper/mydumper) <EarlyBadge/> for large databases

- [Caching](https://redis.io/docs/connect/cli/#remote-backups-of-rdb-files):
`redis-cli`
- [Cassandra®](https://docs.datastax.com/en/cql-oss/3.1/cql/cql_reference/copy_r.html)
Expand Down Expand Up @@ -247,6 +251,12 @@ with the open source [myhoard](https://github.com/aiven/myhoard)
software. Myhoard uses [Percona XtraBackup](https://www.percona.com/)
internally for taking full (or incremental) snapshots for MySQL.

For manual backups and migrations, you can use:

- [`mysqldump`](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html) for small or
medium-sized databases
- [`mydumper`](https://github.com/mydumper/mydumper) <EarlyBadge/> for large databases

#### Edit the backup schedule

<Tabs groupId="group1">
Expand Down
3 changes: 2 additions & 1 deletion docs/products/mysql/howto/do-check-service-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Perform pre-migration check
title: Perform pre-migration checks
sidebar_label: Pre-migration check
---

Learn how to find potential errors before starting your database migration process. This can be done by using either the [Aiven CLI](https://github.com/aiven/aiven-client) or the [Aiven REST API](https://api.aiven.io/doc/#section/Introduction).
Expand Down
224 changes: 173 additions & 51 deletions docs/products/mysql/howto/migrate-database-mysqldump.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,85 @@
---
title: Backup and restore Aiven for MySQL® data using mysqldump
title: Backup and restore Aiven for MySQL® with mysqldump or mydumper
sidebar_label: Backup and restore
---

import MysqlMigrationFreeze from "@site/static/includes/mysql-migration-freeze.md";
import MydumperNote from "@site/static/includes/mydumper-ea.md";
import RelatedPages from "@site/src/components/RelatedPages";
import ConsoleLabel from "@site/src/components/ConsoleIcons";
import EarlyBadge from "@site/src/components/Badges/EarlyBadge";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Backing up your Aiven for MySQ® data to another storage service is a good way to ensure access to your data in case a failure occurs.
Learn how to copy your Aiven for MySQL data to a file, back it up to another Aiven
for MySQL database, and restore it using [`mysqldump`](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html).
Copy your Aiven for MySQL® data to a file, back it up to another Aiven for MySQL database, and restore it using [`mysqldump/restore`](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html) or [`mydumper/myloader`](https://github.com/mydumper/mydumper).

<MydumperNote/>

## Prerequisites

- The `mysqldump`
[tool](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)
installed. See the [official
MySQL](https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html)
documentation on how to install it.
- A source MySQL® database to copy your data from, referred to as `source-db`.
Make sure your service has the required computational power (vCPUs) and
memory capacity to process data migration without resource exhaustion or downtime.

<Tabs groupId="group1">
<TabItem value="1" label="mysqldump/restore" default>

- [`mysqldump` tool](https://dev.mysql.com/doc/refman/8.4/en/mysqldump.html):
[install](https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html) if
missing
- Source database to copy your data from: `source-db`
- Target database to dump your `source-db` data to: `target-db`

</TabItem>
<TabItem value="2" label="mydumper/myloader">

<EarlyBadge/>

<br />
<br />

You can use Aiven for MySQL databases for both the `source-db` and `target-db`.
[Create additional Aiven for MySQL® databases](/docs/products/mysql/howto/create-database)
as/if needed.
- [`mydumper` tool](https://github.com/mydumper/mydumper):
[install](https://mydumper.github.io/mydumper/docs/html/installing.html) if missing
- Source database to copy your data from: `source-db`
- Target database to dump your `source-db` data to: `target-db`

- A target MySQL database to dump your `source-db` data to, referred to as `target-db`.
- Recommended: Pick a plan size that is large enough to store your data, so you can
limit the downtime if you're performing a migration.
</TabItem>
</Tabs>

You can use Aiven for MySQL databases both as `source-db` and as `target-db`.
[Create additional Aiven for MySQL® databases](/docs/products/mysql/howto/create-database)
as needed.

<MysqlMigrationFreeze/>

## Back up the data

### Variables
<Tabs groupId="group1">
<TabItem value="1" label="mysqldump" default>

### Collect connection details

To back up the `source-db` data to the `mydb_backup.sql` file, collect
connection details on your Aiven for MySQL `source-db` service:

To backup the `source-db` data to a file called `mydb_backup.sql` you
need to collect some information about your Aiven for MySQL `source-db`
database. Go to [Aiven Console](https://console.aiven.io/) > your Aiven
for MySQL `source-db` service > **Overview** > the **Connection
information** section and find the following information:
1. Log in to the [Aiven Console](https://console.aiven.io/) and go to your `source-db`
service page.
1. On the <ConsoleLabel name="overview"/> page, find **Connection information** and note
the following:

| Variable | Description |
| -------------------- | ------------------------------------------- |
| `SOURCE_DB_HOST` | **Host** name for the connection |
| `SOURCE_DB_USER` | **User** name for the connection |
| `SOURCE_DB_PORT` | Connection **Port** number |
| `SOURCE_DB_PASSWORD` | Connection **Password** |
| `DEFAULTDB` | Database that contains the `source-db` data |
| Variable | Description |
| -------------------- | ------------------------------------------- |
| `SOURCE_DB_HOST` | **Host** name for the connection |
| `SOURCE_DB_USER` | **User** name for the connection |
| `SOURCE_DB_PORT` | Connection **Port** number |
| `SOURCE_DB_PASSWORD` | Connection **Password** |
| `DEFAULTDB` | Database that contains the `source-db` data |

### Commands
### Back up to a file

Use the following command to back up your Aiven for MySQL data to a file
named `mydb_backup.sql`:
Use the following command to back up your Aiven for MySQL data to the `mydb_backup.sql`
file:

```shell
```bash
mysqldump \
-p DEFAULTDB -P SOURCE_DB_PORT \
-h SOURCE_DB_HOST --single-transaction \
Expand Down Expand Up @@ -79,15 +107,65 @@ Identifiers](https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.
The reason is that GTID's are not available with MyISAM.
:::

</TabItem>
<TabItem value="2" label="mydumper">

<EarlyBadge/>

<br />
<br />

### Collect connection details

To backup the `source-db` data to the `mydb_backup_dir` directory, collect
connection details on your Aiven for MySQL `source-db` service:

1. Log in to the [Aiven Console](https://console.aiven.io/) and go to your `source-db`
service page.
1. On the <ConsoleLabel name="overview"/> page, find **Connection information** and note
the following:

| Variable | Description |
| -------------------- | ------------------------------------------- |
| `SOURCE_DB_HOST` | **Host** name for the connection |
| `SOURCE_DB_USER` | **User** name for the connection |
| `SOURCE_DB_PORT` | Connection **Port** number |
| `SOURCE_DB_PASSWORD` | Connection **Password** |
| `DEFAULTDB` | Database that contains the `source-db` data |

### Back up to a directory

To back up your data with `mydumper`, run:

```bash
mydumper \
--host SOURCE_DB_HOST \
--user SOURCE_DB_USER \
--password SOURCE_DB_PASSWORD \
--port SOURCE_DB_PORT \
--database DEFAULTDB \
--outputdir ./mydb_backup_dir
```

This creates the `mydb_backup_dir` directory containing the backup files.

</TabItem>
</Tabs>

## Restore the data

### Variables
<Tabs groupId="group1">
<TabItem value="1" label="mysqldump/restore" default>

To restore data saved in a file to an Aiven for MySQL database, you need
to include the connection information for the service in the `mysqldump`
command. Go to [Aiven Console](https://console.aiven.io/) > your Aiven
for MySQL `target-db` service > **Overview** > the **Connection
information** section and find the following information:
### Collect connection details

To restore the saved data from the file to your `target-db`, collect
connection details on your Aiven for MySQL `target-db` service:

1. Log in to the [Aiven Console](https://console.aiven.io/) and go to your `target-db`
service page.
1. On the <ConsoleLabel name="overview"/> page, find **Connection information** and note
the following:

| Variable | Description |
| -------------------- | ------------------------------------------- |
Expand All @@ -97,26 +175,70 @@ information** section and find the following information:
| `TARGET_DB_PASSWORD` | Connection **Password** |
| `DEFAULTDB` | Database that contains the `target-db` data |

### Commands
### Restore from the file

Run the following command to load your saved data into your Aiven for
MySQL database:
Run the following command to load the saved data into your `target-db` service:

```shell
```bash
mysql \
-p DEFAULTDB -P TARGET_DB_PORT \
-h TARGET_DB_HOST \
-u TARGET_DB_USER \
--password < mydb_backup.sql
```

The password will be requested at the prompt. You can paste
`TARGET_DB_PASSWORD` into the terminal. Your data should be stored in
your Aiven for MySQL `target-db`. See the `mysqlcheck`
[command](https://dev.mysql.com/doc/refman/8.0/en/mysqlcheck.html) to
perform further analysis of your current MySQL data.
</TabItem>
<TabItem value="2" label="myloader">

<EarlyBadge/>

<br />
<br />

### Collect connection details

To restore the saved data from the directory to your `target-db`, collect
connection details on your Aiven for MySQL `target-db` service:

1. Log in to the [Aiven Console](https://console.aiven.io/) and go to your `target-db`
service page.
1. On the <ConsoleLabel name="overview"/> page, find **Connection information** and note
the following:

| Variable | Description |
| -------------------- | ------------------------------------------- |
| `TARGET_DB_HOST` | **Host** name for the connection |
| `TARGET_DB_USER` | **User** name for the connection |
| `TARGET_DB_PORT` | Connection **Port** number |
| `TARGET_DB_PASSWORD` | Connection **Password** |
| `DEFAULTDB` | Database that contains the `target-db` data |

### Restore from the directory

Use `myloader` to restore the data from the `mydumper` backup:

```bash
myloader \
--host TARGET_DB_HOST \
--user TARGET_DB_USER \
--password TARGET_DB_PASSWORD \
--port TARGET_DB_PORT \
--database DEFAULTDB \
--directory ./mydb_backup_dir
```

</TabItem>
</Tabs>

When the password is requested at the prompt, paste `TARGET_DB_PASSWORD` into the terminal.
When the restore or load process is complete and the data is stored in your `target-db`,
you can use the
[`mysqlcheck` command](https://dev.mysql.com/doc/refman/8.0/en/mysqlcheck.html) to
perform data analysis.

## Read more about migrations
<RelatedPages/>

- [How to migrate to Aiven for MySQL from an external MySQL](/docs/products/mysql/howto/migrate-from-external-mysql)
- [How to perform migration check on your Aiven for MySQL database](/docs/products/mysql/howto/migrate-from-external-mysql)
- [Service backups](/docs/platform/concepts/service_backups#aiven-for-mysql)
- [Migrate to Aiven via CLI](/docs/products/mysql/howto/migrate-from-external-mysql)
- [Migrate to Aiven via console](/docs/products/mysql/howto/migrate-db-to-aiven-via-console)
- [Perform pre-migration checks on your Aiven for MySQL® database](/docs/products/mysql/howto/do-check-service-migration)
33 changes: 15 additions & 18 deletions docs/products/mysql/howto/migrate-db-to-aiven-via-console.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: Migrate to Aiven for MySQL® using via Aiven Console
title: Migrate to Aiven for MySQL® via console
sidebar_label: Migrate to Aiven via console
---

import RelatedPages from "@site/src/components/RelatedPages";
import MysqlMigrationFreeze from "@site/static/includes/mysql-migration-freeze.md";

Use the Console to migrate MySQL® databases to managed MySQL clusters in your Aiven organization.
Use the Aiven Console to migrate MySQL® databases to managed MySQL clusters in your Aiven organization.

:::note
To use the [Aiven CLI](/docs/tools/cli) to migrate your database, see
[Migrate to Aiven for MySQL from an external MySQL](/docs/products/mysql/howto/migrate-from-external-mysql).
[Migrate to Aiven via CLI](/docs/products/mysql/howto/migrate-from-external-mysql).
:::

You can migrate the following:
Expand All @@ -19,25 +19,22 @@ You can migrate the following:
- Cloud-hosted MySQL databases
- Managed MySQL database clusters on Aiven

The Console migration tool provides 2 migration methods:
The console migration tool provides two migration methods:

- **(Recommended) Continuous migration:** Used by default in the tool
and taken as the reference method. This method uses
logical replication so that data transfer is possible not only for
existing data in the source database when triggering the migration
but also for any data written to the source database during the
migration.
- **(Recommended) Continuous migration:** Used by default in the tool and taken as the
reference method. This method uses logical replication so that data transfer is
possible not only for existing data in the source database when triggering the
migration but also for any data written to the source database during the migration.

- **mysqldump**: Exports the current contents of the source database
into a text file and imports it to the target database. Any changes
written to the source database during the migration are **not
- **mysqldump/restore:** Exports the current contents of the source
database into a text file or backup directory and imports it to the target database.
Any changes written to the source database during the migration are **not
transferred**.

When you trigger the migration setup in the Console and initial
checks detect that your source database does not support the logical
replication, you are notified about it via the migration wizard. To
continue with the migration, you can select the alternative
`mysqldump` migration method in the wizard.
When you trigger the migration setup in the console and initial checks detect that your
source database does not support logical replication, you are notified about it via the
migration wizard. To continue with the migration, the wizard allows you to select
`mysqldump/restore` as an alternative migration method.

## Prerequisites

Expand Down
Loading