Skip to content

Commit

Permalink
commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
admin committed Sep 18, 2019
1 parent 4955701 commit 0dcc5a5
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Migrate a local database to ECS {#task_xcw_3yb_wgb .task}

Alibaba Cloud Data Transmission Service \(DTS\) allows you to exchange data between various data sources, such as RDBMS, NoSQL, and OLAP. This topic provides an example scenario that describes how to configure a DTS migration task to migrate data from a MySQL database in your on-premises data center to an ECS instance on Alibaba Cloud.

- Create an ECS instance. For more information, see [Create an instance by using the wizard](../../../../reseller.en-US/Instances/Create an instance/Create an instance by using the wizard.md#).
- In the security group of the ECS instance, allow inbound access to the port on which the MySQL server listens. The default MySQL port is 3306.
- Install the MySQL server on the ECS instance.
- Create a non-root account for the MySQL database on the ECS instance.

For example, you can run the following command to create an account for the MySQL database, with the name as dts and the password as 123456.

``` {#codeblock_2ed_jz1_hw6}
grant all on *.* to 'dts'@'%' IDENTIFIED BY '123456';
```
- Create a non-root account for the local MySQL database.
DTS allows you to migrate data between heterogeneous and homogeneous data sources. It also provides multiple ETL features such as three-level object mapping \(for databases, tables, and columns\) and data filtering. You can use DTS for zero-downtime migration. During the migration process, the source database continues to provide services, minimizing the impact of migration on your business. For information about the databases supported by DTS, see [Data migration](https://partners-intl.aliyun.com/help/doc-detail/26594.htm).
1. Log on to the [DTS console](https://partners-intl.console.aliyun.com/#/dts).
2. In the left-side navigation pane, select **Data Migration.**
3. Select the target region, and click **Create Migration Task**.
![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/129677/156880166539331_en-US.png)
4. Configure a migration task.
1. Specify a task name.
You can use the default name or specify one.
2. Configure the source database.
DTS supports databases accessed through the Internet, leased lines, VPN gateways, and intelligent gateways. The following configurations are described in terms of a database accessed through the Internet. For the migration scheme of other types of databases, see the DTS user manual.
|Parameter|Description|
|:--------|:----------|
|Instance Type|The database with a public IP address.|
|Instance Region|The region to which the database belongs.|
|Database Engine|The type of the local database, MySQL in this example.|
|Host Name or IP Address|The host name or IP address of the server where the local database exists.|
|Port|The port number on which the MySQL server listens.|
|Database Account|The non-root account for accessing the local MySQL database. **Note:** The database account cannot be a root account. Otherwise, errors will occur during connection tests.
|
|Database Password|The password for the non-root account.|
3. Click **Test the Connection** in the lower right corner of the Source Database area.
If the result **Test Passed** is returned, the source database has connected.
4. Configure the target database.
|Parameter|Description|
|:--------|:----------|
|Instance Type|The database in the ECS instance.|
|Instance Region|The region to which the ECS instance belongs.|
|ECS Instance ID|The ID of the ECS instance. DTS supports ECS instances in classic networks or VPCs.|
|Database Engine|The same as the local database, MySQL in this example.|
|Port|The port number on which the MySQL server listens.|
|Database Account|The non-root account for accessing the MySQL database in the ECS instance. **Note:** The database account cannot be a root account. Otherwise, errors will occur during connection tests.
|
|Database Password|The password for the non-root account.|
5. Click **Test the Connection** in the lower right corner of the Target Database area.
If the result **Test Passed** is returned, the target database has connected.
6. Click **Authorize Whitelist and Enter into Next Step.**
5. Configure the migration type and migration object.
1. Configure the migration type.
- Zero downtime migration: Select Structure migration + Full data migration + Incremental data migration.
- Full data migration: Select Structure migration + Full data migration.
2. Configure the migration object.
In the **Migration Object** box, click the database object to migrate, such as a database, table, or column. Then click **\>**to add it to the **Selected Objects** box.
**Note:** By default, after a database object is By default, after a database object is migrated to a MySQL database in your ECS instance, the object name remains the same as that in the local MySQL database. If the migrated database object has different names on the source and target instances, you need to use the object name mapping function provided by DTS to meet the requirements. For more information, see [Object name mapping](https://partners-intl.aliyun.com/help/doc-detail/26628.htm).
6. Click **Pre-Check and Start**.
Before migration begins, DTS pre-checks the connectivity, authority, and log format of the database.
After the pre-check is successful, you can view the status and progress of your tasks in the **Migration Task List**.
![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/128824/156880166539321_en-US.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# 本地自建数据库迁移到ECS {#task_xcw_3yb_wgb .task}

数据传输服务(Data Transmission Service,简称DTS)是阿里云提供的支持RDBMS、NoSQL、OLAP等多种数据源之间数据交互的数据服务。本文以MySQL数据库为例,介绍如何配置DTS迁移任务,实现从本地自建数据库到ECS实例自建数据库间的数据迁移。

- 创建ECS实例。具体操作步骤,请参见[使用向导创建实例](../../../../intl.zh-CN/实例/创建实例/使用向导创建实例.md#)
- 在ECS实例的安全组中放行MySQL监听的端口号。MySQL监听的默认端口号为3306。
- 在ECS实例上安装MySQL数据库。
- 为ECS实例上的MySQL数据库创建非root账号。

例如,您可以运行以下命令为MySQL数据库创建名为dts、密码为123456的账号。

``` {#codeblock_601_6jk_g1p}
grant all on *.* to 'dts'@'%' IDENTIFIED BY '123456';
```
- 为本地MySQL数据库创建非root账号。
DTS提供的数据迁移功能能够支持同异构数据源之间的数据迁移,同时提供了库表列三级映射、数据过滤多种ETL特性。您可以使用DTS进行零停机迁移,在迁移过程中,源数据库正常持续提供服务,最大程度降低迁移对业务的影响。DTS支持的数据库类型请参见[数据迁移](https://www.alibabacloud.com/help/doc-detail/26594.html)。
1. 登录[数据传输DTS控制台](https://dts.console.aliyun.com/)。
2. 在左侧导航栏,选择**数据迁移**。
3. 选择ECS实例所在地域,并单击**创建迁移任务**。
![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/128824/156880165739275_zh-CN.png)
4. 配置迁移任务。
1. 配置任务名称。
您可以使用默认的名称或者自定义名称。
2. 配置源库信息。
DTS支持通过公网、VPN网关、专线及智能网关访问的自建数据库。本文以公网自建数据库为例介绍配置信息。其他类型数据库的迁移方案请参考DTS用户手册。
|参数名称|参数值|
|:---|:--|
|实例类型|有公网IP的自建数据库。|
|实例地区|本地数据库所在的地域。|
|数据库类型|本地数据库的类型。本示例中,数据库类型为MySQL。|
|主机名或IP地址|本地数据库所在主机的主机名或IP地址。|
|端口|MySQL数据库监听的端口号。|
|数据库账号|本地MySQL数据库的非root访问账号。 **说明:** 数据库账号必须填写非root账号,否则测试连接时会报错。
|
|数据库密码|非root账号对应的密码。|
3. 单击源库信息右下角的**测试连接**。
当返回的结果为**测试通过**时,表示源库连接正常。
4. 配置目标库信息。
|参数名称|参数值|
|:---|:--|
|实例类型|ECS上的自建数据库。|
|实例地区|ECS实例所在地域。|
|ECS实例ID|ECS实例的实例ID。DTS 支持经典网络及专有网络的ECS实例。|
|数据库类型|与本地自建数据库的类型相同。本示例中,数据库类型为MySQL。|
|端口|MySQL数据库监听的端口号。|
|数据库账号|ECS实例上MySQL数据库的非root账号。 **说明:** 数据库账号必须填写非root账号,否则测试连接时会报错。
|
|数据库密码|非root账号对应的密码。|
5. 单击目标库信息右下角的**测试连接**。
当返回的结果为**测试通过**时,表示目标库连接正常。
6. 单击**授权白名单并进入下一步**。
5. 配置迁移类型及迁移对象。
1. 配置迁移类型。
- 业务零停机迁移,请选择:结构迁移+全量数据迁移+增量数据迁移。
- 全量迁移,请选择:结构迁移+全量数据迁移。
2. 配置迁移对象。
在**迁移对象**框中单击要迁移的数据库对象,如数据库、表或列,然后单击**\>**添加到**已选择对象**框中。
**说明:** 默认情况下,数据库对象迁移到ECS自建MySQL实例后,对象名跟本地MySQL实例一致。如果迁移的数据库对象在源实例跟目标实例上名称不同,您需要使用DTS提供的对象名映射功能,详细信息请参考[库表列映射](https://www.alibabacloud.com/help/doc-detail/26628.html)。
6. 单击**预检查并启动**。
在迁移任务正式启动之前,会预检查连通性、权限及日志格式等。下图表示预检查成功通过。
![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/128824/156880165739304_zh-CN.png)
预检查通过后,您可以在**迁移任务列表**中查看迁移任务的迁移状态及进度。
![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/128824/156880165739321_zh-CN.png)

0 comments on commit 0dcc5a5

Please sign in to comment.