Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Data Replication Service
Quick Start
Issue 03
Date 2018-08-31
HUAWEI TECHNOLOGIES CO., LTD.
Copyright © Huawei Technologies Co., Ltd. 2018. All rights reserved.No part of this document may be reproduced or transmitted in any form or by any means without prior writtenconsent of Huawei Technologies Co., Ltd. Trademarks and Permissions
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei and thecustomer. All or part of the products, services and features described in this document may not be within thepurchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information,and recommendations in this document are provided "AS IS" without warranties, guarantees orrepresentations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.
Huawei Technologies Co., Ltd.Address: Huawei Industrial Base
Bantian, LonggangShenzhen 518129People's Republic of China
Website: http://e.huawei.com
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. i
Contents
1 Quick Start for Online Migration.............................................................................................. 11.1 Before You Apply...........................................................................................................................................................11.2 Process............................................................................................................................................................................ 21.3 Migration Task Statuses..................................................................................................................................................31.4 Creating an Online Migration Task................................................................................................................................ 4
2 Quick Start for Offline Migration............................................................................................112.1 Before You Apply......................................................................................................................................................... 112.2 Migration Task Statuses................................................................................................................................................122.3 Creating an Offline Migration Task..............................................................................................................................132.3.1 Migrating Full Backups from Self-Built OBS Buckets to Clouds............................................................................ 132.3.2 Migrating RDS Full Backups to Clouds....................................................................................................................152.4 Checking the Database Recovery Model......................................................................................................................17
A Change History........................................................................................................................... 19
Data Replication ServiceQuick Start Contents
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. ii
1 Quick Start for Online Migration
1.1 Before You ApplyYou must complete the tasks described in this section before you create a Data ReplicationService (DRS) online migration task.
DB Engines
Determine DB engines. DRS supports the following DB engines and can migrate data onlybetween databases of the same type, for example, from MySQL to MySQL:
l MySQL
l Microsoft SQL Server
l PostgreSQL
l MongoDB
Network Types
Determine network types. DRS can migrate data through a Virtual Private Cloud (VPC),Virtual Private Network (VPN), and public network.
Table 1-1 Network types
NetworkType
Before You Apply
VPC l Currently, the source database must be in the same AZ as thedestination database to reduce network delay.
l A VPC is a logically isolated network.– The source and destination databases can be either in the same
VPC or in different VPCs.– The subnet segments of the source and destination databases
cannot be the same or overlapped.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 1
NetworkType
Before You Apply
VPN You need to establish a VPN connection between your local data centerand the VPC hosting the destination database. Before a migration,ensure that the VPN connection is normal and you can access the VPC.
Public network l Ensure that the destination DB instance has been bound with anelastic IP address (EIP) and can access the source database port fromthe public network, if the destination DB instance runs the followingDB engines:– MySQL
For details about how to bind an EIP to a Relational DatabaseService (RDS) MySQL DB instance, see the "Enabling andDisabling Public Accessibility" section in the RelationalDatabase Service Quick Start.
– PostgreSQLFor details about how to bind an EIP to an RDS PostgreSQL DBinstance, see the "Binding an EIP to a DB Instance" section inthe Relational Database Service Quick Start.
– MongoDBFor details about how to bind an EIP to a Document DatabaseService (DDS) replica set, see the "Enabling or DisablingPublic Accessibility" section in the Document Database ServiceQuick Start.For details about how to bind an EIP to a DDS cluster, see the"Enabling or Disabling Public Accessibility" section in theDocument Database Service Quick Start.
l If you do not enable SSL to encrypt connections between the sourceand destination databases when you select the public network typefor migration, ensure that the data to be migrated is non-confidential.
1.2 ProcessThis section provides a guideline for using DRS.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 2
Figure 1-1 Migration process
1.3 Migration Task StatusesMigration statuses indicate different migration phases.
Table 1-2 lists statuses and descriptions of online migration tasks.
Table 1-2 Statuses and descriptions of online migration tasks
Status Description
Creating A replication instance is being created for DRSa.
Configuration The replication instance is successfully created, but the migration taskhas not started. You can continue to configure the task.
Frozen DB instances are frozen when the account balance is less than or equalto ¥0.
Pending start The scheduled migration task has been delivered to the replicationinstance, waiting for the replication instance to start the migration task.
Full migration The full migration task is being performed.
Incrementalmigration
The incremental migration task is being performed.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 3
Status Description
Faultrectification
If a replication instance is faulty, the system automatically restores themigration task.
Task stopping The replication instance and resources used for executing the migrationtask are being released.
Complete The migration task is complete and the replication instance is released.
a: A replication instance refers to an instance that performs the migration task. DRS usesthe replication instance to connect to the source database, read source data, and replicatethe data to the target database.
NOTE
The deleted migration task is not displayed in the status list.
1.4 Creating an Online Migration TaskThis section describes how to create and configure an online migration task on the DRSconsole.
Scenarios
You can create a migration task to migrate data from a source database to a destinationdatabase.
l Currently, you can create a maximum of five online migration tasks.
l DRS allows you to migrate DB instances to RDS or DDS through a VPC, VPN, orpublic network.
NOTE
If you want to migrate data to the destination RDS or DDS through a VPN, you need to establish aconnection between the network hosting the source database and the VPC hosting the destination RDSor DDS. For more information about VPN, see the Virtual Private Network User Guide.
Prerequisitesl For details, see Restrictions.
l You have registered a HUAWEI CLOUD account.
l Your account balance is greater than or equal to ¥0.
Procedure
Step 1 Log in to the management console.
Step 2 Click in the upper left corner and select a region and a project.
Step 3 Under Database, click Data Replication Service to go to the DRS console.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 4
Step 4 On the Online Migration Management page, click Create Migration Task.
Step 5 On the Create Replication Instance page, configure information about the task, recipient,and replication instance. Then, click Next.
Figure 1-2 Specifying replication instance information
Table 1-3 Task description and recipient information
Parameter Description
Task Name Consists of 4 to 64 characters, starts with a letter, and can contain onlyletters (case-insensitive), digits, hyphens (-), and underscores (_).
SendNotifications
This parameter is optional. If it is enabled, DRS will send notifications toa specified recipient by SMS messages or emails when an exceptionoccurs on a migration task.NOTE
You need to handle exceptions within 48 hours of receiving SMS messages oremails.
Description Consists of a maximum of 256 characters and cannot contain thefollowing special characters: !<>&'"\
Table 1-4 Replication instance information
Parameter Description
Source DBEngine
Supports MySQL, Microsoft SQL Server, PostgreSQL, and MongoDB.
DestinationDB Engine
Supports MySQL, Microsoft SQL Server, PostgreSQL, and MongoDB.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 5
Parameter Description
Network Type Supports VPC, VPN, and public network. By default, the value is Publicnetwork.l VPC: is suitable for migrations between RDS databases or between
DDS databases.l Public network: is suitable for migrations from on-premises or
external cloud databases to RDS or DDS databases. The destinationRDS or DDS database must be bound with an EIP.
l VPN: is suitable for migrations from on-premises self-built databasesto RDS or DDS databases, or between RDS or DDS databases fromone region to another.
DestinationDB Instance
Specifies an RDS or DDS DB instance you have created.
Step 6 On the Configure Source and Destination Databases page, wait until the replicationinstance is created. Then, specify source and destination database information. You areadvised to click Test Connection for both the source and destination databases to checkwhether they have been connected to the replication instance. After connection tests aresuccessful, select the check box before the agreement and click Next.
Figure 1-3 Specifying source and destination database information
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 6
Table 1-5 Source database information
Parameter Description
Source DatabaseType
l The source database can be a non-RDS DB instance or an RDSDB instance if the source database DB engine is MySQL,Microsoft SQL Server, or PostgreSQL.
l The source database can be a non-DDS DB instance or a DDS DBinstance if the source DB engine is MongoDB.NOTE
You need to specify the source database type when you select the VPCnetwork type.
VPC A dedicated virtual network in which the source database is located.It isolates networks for different services. You can select an existingVPC or create a VPC. For details on how to create a VPC, see the"Creating a VPC" section in the Virtual Private Cloud User Guide.NOTE
You need to specify VPC when you select the VPC network type.
Subnet A subnet provides dedicated network resources that are logicallyisolated from other networks, improving network security. Subnetscan take effect only in AZs. You need to enable the Dynamic HostConfiguration Protocol (DHCP) for subnets where you plan to createthe source database, and cannot disable the DHCP during creation.NOTE
You need to specify subnet information for the source database when youselect the VPC network type.
IP Address orDomain Name
Enter the IP address or domain name of the source database.
Port Enter an integer ranging from 1 to 65535, which indicates the portnumber of the source database.
DatabaseUsername
Enter the username of the source database.
Database Password Enter the password of the source database.
SSL Connection Encrypts connections between source and destination databases. Ifyou enable the SSL connection, you need to upload an SSL CA rootcertificate.
NOTE
The IP address, domain name, username, and password of the source database are encrypted and storedin the system until the task is deleted.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 7
Table 1-6 Destination database information
Parameter Description
DB InstanceName
Indicates the RDS or DDS DB instance you have selected duringreplication instance creation by default and cannot be changed.
DatabaseUsername
Enter the username of the destination database.
DatabasePassword
Enter the password of the destination database. Database username andpassword are encrypted and stored in the system until the task is deleted.
Step 7 On the Select Migration Type page, select a migration type and objects. Then, click Next.
Figure 1-4 Selecting a migration type and objects
Table 1-7 Migration types and objects
Parameter Description
Full This migration type is suitable for scenarios where services can beinterrupted. It migrates all database objects and data, including tables,views, stored procedures, and triggers, in a non-system database, to adestination database at one time.NOTE
If you perform a full migration, you are advised to stop operations on the sourcedatabase. Otherwise, data generated in the source database during the migration willnot be synchronized to the destination database.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 8
Parameter Description
Full+Incremental
This migration type allows you to migrate data with minimal downtime.After a full migration initializes the destination database, an incrementalmigration parses logs to ensure data consistency between the source anddestination databases.NOTE
If you perform both full and incremental migrations, data generated during the fullmigration will be synchronized to the destination database with minimal downtime,ensuring both source and destination databases remain accessible.
MigrationObject
The objects can be databases or tables. After the objects are migrated to thedestination DB instance, the object names will remain the same as those ofsource database and cannot be modified.NOTE
If you only select some tables to migrate, the migration may fail because the objects(including triggers, stored procedures, and views) hold in the migrated tables may beassociated with the tables not to be migrated. To prevent migration failures, you areadvised to migrate all databases or check that the objects in the migrated tables are notassociated with the tables not to be migrated. You are advised to migrate all databasesor check before migration that no objects depend on tables that are not migrated.
Step 8 On the Check Task page, check the migration task.
l If any check item fails, check the failure cause and rectify the fault. After the fault isrectified, click Check Again.
For details about how to handle check item failures, see the "Check Items" section in theData Replication Service User Guide.
l If all check items are successful, click Next.
Figure 1-5 Checking a task
Step 9 On the Confirm Task page, specify Start Time, select the check box before the agreement,and click Next.
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 9
Figure 1-6 Confirming a task
Step 10 After the task is submitted, you can view and manage it on the Online MigrationManagement page.l For more information about task statuses, see Table 1-2.
l You can click in the upper-right corner to view the latest task status.
----End
Data Replication ServiceQuick Start 1 Quick Start for Online Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 10
2 Quick Start for Offline Migration
2.1 Before You ApplyYou must complete the tasks described in this section before you create a DRS offlinemigration task.
Common Itemsl Determine the DB engine. DRS offline migration supports the Microsoft SQL Server DB
engine.l If you select a self-built Object Storage Service (OBS) bucket for the backup file source,
ensure that the region where the self-built OBS bucket is located is the same as theregion where the destination DB instance is located.
l If you select an RDS full backup for the backup file source, ensure that the RDS DBinstance has full backups.
l The backup database name must:– Contain 1 to 128 characters.– Start with a letter and contain only uppercase letters, lowercase letters, digits,
hyphens (-), and underscores (_).– Be unique and cannot be any of the following (case-sensitive): msdb, master,
model, tempdb, rdsadmin, and resource.
Microsoft SQL Server Database Backup Filesl Requirements for local backup files:
– The suffix of the backup file to be uploaded to an OBS bucket must be .bak.Only .bak files can be selected in the OBS backup file list.
– The backup file name contains 1 to 128 characters.– The backup file name must start with a letter and can contain only uppercase letters,
lowercase letters, digits, hyphens (-), and underscores (_).– The size of the backup file must be less than 85% of the total size of the destination
DB instance.– Backup files must be uploaded to the root directory of a self-built OBS bucket.
Backup files in OBS bucket folders cannot be migrated.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 11
l Backup file source:– Self-built OBS bucket: Backup files must be backed up using the full recovery
model of Microsoft SQL Server Management Studio. For details, see sectionChecking the Database Recovery Model.
– RDS full backup: Full backup files are manually or automatically created for anRDS DB instance.
Microsoft SQL Server DB Instancesl Determine the destination DB engine.
DRS supports offline migrations from backup files of the following DB engine versionsto destination DB instances.
Table 2-1 Determining the destination DB engine versions
DB Engine Version ofBackup Files
Compatibility Level DB Engine Version of theDestination DB Instance
Microsoft SQL Server 2008 100 Microsoft SQL Server 2008
Microsoft SQL Server 2005 90
Microsoft SQL Server 2000 80
Microsoft SQL Server 2014 120 Microsoft SQL Server 2014
Microsoft SQL Server 2012 110
Microsoft SQL Server 2008 100
l Full backup files of Microsoft SQL Server databases of later versions cannot be restored
on databases of earlier versions, even though you change the compatibility level.l During a migration, stop writing transactions to the destination DB instance.l During a migration, if Overwrite Data is selected, high availability of the destination
database is disabled by default. After the migration is complete, high availability isrestored automatically.
2.2 Migration Task StatusesMigration statuses indicate different migration phases.
Table 2-2 lists statuses and descriptions of offline migration tasks.
Table 2-2 Statuses and descriptions of offline migration tasks
Status Description
Restoring A backup file is being restored to the destination database.
Successful A backup file has been restored to the destination database.
Failed A backup file fails to be restored to the destination database.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 12
NOTE
The deleted migration task is not displayed in the status list.
2.3 Creating an Offline Migration TaskThis section describes how to create an offline migration task.
2.3.1 Migrating Full Backups from Self-Built OBS Buckets toClouds
This section describes how to migrate full backups from self-built OBS buckets to clouds.
You can create an offline migration task using the DRS console or application programminginterfaces (APIs). For details about how to use APIs to create an offline migration task, seethe "Submitting an Offline Migration Task" section in the Data Replication Service APIReference.
Scenarios
To migrate a local database offline, you can upload backup files of the local database to a self-built OBS bucket and then download these backup files from the OBS bucket.
Prerequisitesl You have registered a HUAWEI CLOUD account.l Your account balance is greater than or equal to ¥0.l An OBS bucket is available. If there is no OBS bucket, create one. For detailed
operations, see "Managing Buckets" in the Object Storage Service Console OperationGuide.
l Database backup files have been uploaded to the self-built OBS bucket. If there are nobackup files in the OBS bucket, upload local backup files to it and ensure that the backupfile name format is correct. For details about how to upload backup files, see the"Uploading a File" section in the Object Storage Service Console Operation Guide.
l OBS Browser has been installed for uploading multiple files in batches or large filesgreater than 50 MB in size. For detailed operations, see the Object Storage ServiceClient Guide (OBS Browser). To download OBS Browser, see Developer Tools.
NOTE
l The Key Management Service (KMS) is not supported for local backup files uploaded to aself-built OBS bucket.
l When you upload backup files to a self-built OBS bucket, do not select Archive for StorageClass. Otherwise, the migration will fail.
l Currently, only backup files with the suffix .bak can be uploaded to OBS buckets.
l Backup files must be uploaded to the root directory of a self-built OBS bucket. Backup files inOBS bucket folders cannot be migrated.
Procedure
Step 1 Log in to the management console.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 13
Step 2 Click in the upper left corner and select a region and a project.
Step 3 Under Database, click Data Replication Service to go to the DRS console.
Step 4 On the Offline Migration Management page, click Create Migration Task.
Step 5 On the Select Backup page, specify Task Name and Description, select Self-Built OBSBucket for Backup File Source and select a bucket name for Bucket Name. In the backupfile list, select a backup file. Then, click Next.
Figure 2-1 Selecting a backup
l The task name consists of 4 to 64 characters, starts with a letter, and can contain onlyletters (case-insensitive), digits, hyphens (-), and underscores (_).
l The description consists of a maximum of 256 characters and cannot contain thefollowing special characters: !<>&'"\
Step 6 On the Select Destination page, specify Destination RDS DB Instance Name and BackupDatabase Name, and select Overwrite Data as required. Then, click Next.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 14
Figure 2-2 Selecting a destination RDS DB instance
The backup database name is case-sensitive and must be the same as a database name (exceptthe system databases) in the backup file. It is 1 to 128 characters long, must start with a letter,and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores(_).
Step 7 On the Confirm Task page, check configuration details, read and agree to the agreement, andclick Next.
Step 8 In the task list on the Offline Migration Management page, check whether the task is in theRestoring status. If the migration is successful, the task status becomes Successful.
----End
2.3.2 Migrating RDS Full Backups to CloudsThis section describes how to migrate RDS full backups to clouds.
You can create an offline migration task using the DRS console or APIs. For details abouthow to use APIs to create an offline migration task, see the "Submitting an OfflineMigration Task" section in the Data Replication Service API Reference.
Scenarios
You can use the full backups of Microsoft SQL Server DB instances in the cloud to migratedata offline.
Prerequisitesl You have registered a HUAWEI CLOUD account.
l Your account balance is greater than or equal to ¥0.
l Microsoft SQL Server DB instances have full backups. If there are no full backups,create a full backup for the DB instance. For details, see the "Creating a ManualBackup" section in the Relational Database Service User Guide.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 15
Procedure
Step 1 Log in to the management console.
Step 2 Click in the upper left corner and select a region and a project.
Step 3 Under Database, click Data Replication Service to go to the DRS console.
Step 4 On the Offline Migration Management page, click Create Migration Task.
Step 5 On the Select Backup page, specify Task Name and Description, select RDS Full Backupfor Backup File Source, and select a backup file in the backup file list. Then, click Next.
Figure 2-3 Selecting a backup
l The task name consists of 4 to 64 characters, starts with a letter, and can contain onlyletters (case-insensitive), digits, hyphens (-), and underscores (_).
l The description consists of a maximum of 256 characters and cannot contain thefollowing special characters: !<>&'"\
Step 6 On the Select Destination page, specify Destination RDS DB Instance Name and BackupDatabase Name, and select Overwrite Data as required. Then, click Next.
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 16
Figure 2-4 Selecting a destination RDS DB instance
The backup database name is case-sensitive and must be the same as a database name (exceptthe system databases) in the backup file. It is 1 to 128 characters long, must start with a letter,and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores(_).
Step 7 On the Confirm Task page, check configuration details, read and agree to the agreement, andclick Next.
Step 8 In the task list on the Offline Migration Management page, check whether the task is in theRestoring status. If the migration is successful, the task status becomes Successful.
----End
2.4 Checking the Database Recovery ModelThis section describes how to check the database recovery model and set the recovery modelas required.
ScenariosBackup files uploaded to a self-built OBS bucket must be backed up using the full recoverymodel of Microsoft SQL Server Management Studio. You need to check the databaserecovery model and set the recovery model as required before migrating data.
Procedure
Step 1 Start Microsoft SQL Server Management Studio.
Step 2 Log in to the local database to be migrated.
Step 3 Check the database recovery model:use master;goselect name, case recovery_modelwhen 1 then 'FULL'when 2 then 'BULD_LOGGED'
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 17
when 3 then 'SIMPLE' end model from sys.databaseswhere name not in ('master','tempdb','model','msdb');go
Check the model value.
l If the model value is not FULL, go to Step 4.l If the model value is FULL, no further operations are required.
Step 4 Change the database recovery model to FULL:
NOTE
Changing the database recovery model to FULL will increase the total size of Microsoft SQL Serverlogs. Before performing this operation, ensure that the storage space is sufficient.
ALTER DATABASE [dbname] SET RECOVERY FULL;goALTER DATABASE [dbname] SET AUTO_CLOSE OFF;go
Step 5 After backup files are exported, run the following commands to restore the database recoverymodel:ALTER DATABASE [dbname] SET RECOVERY SIMPLE;go
----End
Data Replication ServiceQuick Start 2 Quick Start for Offline Migration
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 18
A Change History
Date Description
2018-08-31 This issue is the third official release, which incorporates the followingchanges:l Online migration
– Supported migrations of PostgreSQL databases.– Added description of the relationship between DRS and OBS.
2018-07-14 This issue is the second official release, which incorporates the followingchange:l Online migration
– Supported migrations of MongoDB databases.
2018-06-30 This issue is the first official release.
Data Replication ServiceQuick Start A Change History
Issue 03 (2018-08-31) Copyright © Huawei Technologies Co., Ltd. 19