All Products
Search
Document Center

Server Migration Center:Import the information about a migration source by using the CLI

Last Updated:Feb 04, 2024

Server Migration Center (SMC) allows you to import the information about a migration source by using an activation code on the CLI. You can generate an activation code and a command in the SMC console and then run the command on the source server. This way, you can import the information about the migration source by using the activation code. This topic describes how to use the CLI to import the information about a migration source with a few clicks.

Note

An SMC activation code includes an access token ID and an access token code. It is an authentication code that is dedicated to the SMC client to import the information about a migration source. Different from an Alibaba Cloud AccessKey pair, an SMC activation code cannot be used to access other services. Each activation code has its migration source quota and validity period, which ensures security.

Prerequisites

The source server is accessible over the Internet.

Procedure

Choose a method based on the operating system type of your migration source.

Import the information about a Linux server

  1. Log on to the SMC console.

  2. In the left-side navigation pane, click Migration Sources.

  3. On the Migration Sources page, click Import Migration source.

  4. Configure the parameters to obtain a command that is used to import the information about migration sources.

    The following table describes the parameters.

    Parameter

    Description

    Migration Source Type

    The type of the migration source. Valid values:

    • Physical Machine/VM/Cloud Server

    • ECS

    • VMware VM

    • TencentCloud Lighthouse

    • AWS Lightsail Instances

    • HUAWEI CLOUD HECS

    Import Method

    The method that is used to import the information about the migration source. Select Use CLI to Import Server.

    Migration Source Quota

    The number of migration sources whose information can be imported by using the activation code. Valid values: 1 to 1000. Default value: 10.

    Validity Period

    The validity period of the activation code. Unit: day. Valid values: 1 to 90. Default value: 30.

    Activation Code

    Generate the activation code and copy the generated command by performing the following steps:

    1. Click Generate.

    2. Click the Linux Shell tab.

      Note

      You can also click the user_config.json tab to copy the values of the access_token_id and access_token_code parameters. If you import the information about a migration source by using the SMC client, run the ./go2aliyun_client --accesstokenid=xxx --accesstokencode=xxx command. Replace xxx with the copied values.

    3. Click Copy to copy the command.

  5. Log on to the Linux server and run the copied command as an administrator to import the information about the migration source.

    image.png

    The following sample command output indicates that the import is successful:

    [2022-08-11 14:40:45] [Info]  Snapshot Check...
    [2022-08-11 14:40:49] [Info]  Verify User Account...
    [2022-08-11 14:40:49] [Info]  Generate SSH Key...
    [2022-08-11 14:40:49] [Info]  Import Source Server...
    [2022-08-11 14:40:49] [Info]  Import Source Server [s-bp18x8751kgz2oyh****] Successfully!
    [2022-08-11 14:40:50] [Info]  =========   Run In BackGround Daemon Mode   =========
    [2022-08-11 14:40:50] [Info]  Goto Aliyun Begin...
    [2022-08-11 14:40:50] [Info]  Check Source Server Status...
    [2022-08-11 14:40:50] [Info]  Check Replication Job Status...
    Please Goto SMC Console To Create New Job, time: 1m0s    -
    Note

    If the information about the migration source fails to be imported or an error occurs during the migration, you can check the log files in the directory of the SMC client for more information. By default, the SMC client is installed in the /smc directory on a Linux server.

Import the information about a Windows server

  1. Log on to the SMC console.

  2. In the left-side navigation pane, click Migration Sources.

  3. On the Migration Sources page, click Import Migration source.

  4. Configure the parameters to obtain a command that is used to import the information about migration sources.

    The following table describes the parameters.

    Parameter

    Description

    Migration Source Type

    The type of the migration source. Valid values:

    • Physical Machine/VM/Cloud Server

    • ECS

    • VMware VM

    • TencentCloud Lighthouse

    • AWS Lightsail Instances

    • HUAWEI CLOUD HECS

    Import Method

    The method that is used to import the information about the migration source. Select Use CLI to Import Server.

    Migration Source Quota

    The number of migration sources whose information can be imported by using the activation code. Valid values: 1 to 1000. Default value: 10.

    Validity Period

    The validity period of the activation code. Unit: day. Valid values: 1 to 90. Default value: 30.

    Activation Code

    Generate the activation code and copy the generated command by performing the following steps:

    1. Click Generate.

    2. Click the Windows Powershell tab.

      Note

      You can also click the user_config.json tab to copy the values of the access_token_id and access_token_code parameters. If you import the information about a migration source by using the Windows GUI version of the SMC client, set the Token Id and Token Code parameters to the copied values. For more information, see Use the Windows GUI version of an SMC client.adsad5

    3. Click Copy to copy the command.

  5. Log on to the Windows server and start Windows PowerShell as an administrator.

  6. Run the copied command to import the information about the migration source.

    image.png

    The following sample command output indicates that the import is successful:

    Windows PowerShell
    Copyright (C) 2016 Microsoft Corporation. All rights reserved. 
    
    PS C:\Users\Administrator> $(New-Object -TypeName System.Net.WebClient).DownloadFile('https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/run_smc_client.ps1',
     'C:\run_smc_client.ps1'); C:\run_smc_client.ps1 -accesstokenid at-bp14nc53v615hves**** -accesstokencode tcVsYOTWPQoIjocL+X7A+ufZvz5/****
    [2023-01-06 13:53:56] [info] start download smc client
    [2023-01-06 13:53:59] [Info]  ========= Goto Aliyun Client 2.6.5. =====
    [2023-01-06 13:53:59] [Info]  Load User Config...
    [2023-01-06 13:53:59] [Info]  Load Client Data...
    [2023-01-06 13:53:59] [Info]  Check System Info [Windows Server 2016 x8
    OS Info: Microsoft Windows Server 2016,  (10.0.14393 )
    CPU Info: Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
    CPU Usage: 2 Cores (1.54%) Memory Usage: 1.53GB/8.00GB (19.13%)
    Hostname: test0 IP Address: 192.168.XX.XX Mac Address: 00163E10****
    [2023-01-06 13:54:00] [Info]  Verify User Account...
    [2023-01-06 13:54:00] [Info]  Generate SSH Key...
    [2023-01-06 13:54:01] [Info]  Import Source Server...
    [2023-01-06 13:54:01] [Info]  Import Source Server [s-bp19rlidl3mwuptc****] Successfully!
    [2023-01-06 13:54:02] [Info]  =========   Run In Daemon Mode   ========
    [2023-01-06 13:54:02] [Info]  Goto Aliyun Begin...
    [2023-01-06 13:54:02] [Info]  Check Source Server Status...
    [2023-01-06 13:54:02] [Info]  Check Replication Job Status...
    Please Goto SMC Console To Create New Job, time: 4m34s    \
    Note

    If the information about the migration source fails to be imported or an error occurs during the migration, you can check the log files in the directory of the SMC client for more information. By default, the SMC client is installed in the C:\smc directory on a Windows server.

What to do next

After the information about a migration source is imported, you can create and start a migration job. You can refer to one of the following topics to create a migration job based on your business requirements: