preface
In many cases, how to migrate the server to The ECS of Ali Cloud has become a stumbling block for many users on the road to the cloud, especially in the local operating system has very complex software deployment at this time migrating to the cloud or migration between different public clouds makes many people hesitant.
Ali cloud to provide cloud relocation tool is born for this migration pain point, especially easy to use!
introduce
The cloud migration tool directly uses the public network to migrate users’ systems without occupying extra local storage space, which greatly reduces the migration burden and migration cost. At the same time, this tool has made a lot of efforts in ease of use. Compared with the previous version of the tool, it greatly simplifies the use conditions and reduces the threshold of use, making it possible for users to migrate their system to Ali Cloud with one click.
Of course, the bottleneck is also some, that is the bandwidth, but many physical servers themselves bandwidth is not small, cloud servers can also be opened by traffic billing, can say that the bottleneck can be solved.
All in all, its characteristics are: low operation complexity, migration speed block, high system restore degree.
The cloud migration tool supports the following images: Windows Server and mainstream Linux versions, P2V (migrating physical servers), and V2V (migrating VMS or public clouds).
The system platform | The version number | Support state |
---|---|---|
Windows | 2003/2008/2012/2016 | support |
CentOS | 5/6/7 | support |
Red Hat | 5/6/7 | support |
Ubuntu | 10/12/14/16/17 | support |
Debian | 7/8/9 | support |
SUSE Linux | 12.2/11.4/12.1 | support |
OpenSUSE | 13.1 | support |
Gentoo | 13.0 | support |
Demand & Gain
Products to be used:
- The balance of Aliyun account is greater than or equal to 100 Yuan (according to the amount required for opening)
-
Physical machines, VMS, and public cloud servers that can connect to the public network
In this article you will learn:
- Use the move cloud tool to achieve the image migration to Ali Cloud
The tutorial
Tutorial to Tencent cloud CVM as an example to introduce Linux hair version of the migration, Tencent cloud · Shanghai region image migration to Ali cloud. It is recommended that you create a custom image for instances with small bandwidth and use the image to create a volume instance with 100 mbit/s bandwidth charged by traffic. If the transmission volume of physical machines is very large, you can also use ali Cloud’s high-speed channel service to establish a dedicated transmission line.
I then created a pure Nginx environment and put a default home page and two files in /root/qianyun.txt to verify the migration accuracy.
To prepare
Installing the Base Library
First, install the basic necessary software Rsync library:
CentOS, RHEL:
Yum install epel-release -y yum install rsync git python python-pip -- yCopy the code
Debian, Ubuntu:
Apt install rsync git python python -- yCopy the code
Build and install Cloud-init
Download cloud-init source code:
git clone https://git.launchpad.net/cloud-init
cd cloud-initCopy the code
Install Python library dependencies:
pip install -r requirements.txtCopy the code
Iii. Compilation and installation:
python setup.py installCopy the code
4. Modify configuration files:
mv /etc/cloud/cloud.cfg /etc/cloud/cloud.cfg.bak
cd /etc/cloud/
wget https://gitee.com/yunvy/codes/p0omxzqs8ecaj5iwtu9b175/raw?blob_name=cloud.cfg -O cloud.cfg Copy the code
Create a permission subaccount
Since the in-between operations are automatically implemented from the command line, an Access Key procedure is required, but the default Access Key is global, so we should use Access control RAM to create a sub-account with ECS administrative privileges only.
However, due to the space limitation, it is not suitable to expand on access control, you can refer to “Using Aliyun SMS Service curve to Achieve REAL name WP Comments” to see the fourth step and the steps in opening access control service.
Download the cloud migration tool
Download the source code package
cd /root/
wget http://p2v-tools.oss-cn-hangzhou.aliyuncs.com/Alibaba_Cloud_Migration_Tool.zip
unzip Alibaba_Cloud_Migration_Tool.zipCopy the code
Two, after decompression there will be two compression packages, one is Linux and one is Windows, it is clear that we are Linux, of course.
[root@VM_199_173_centos ~]# unzip Alibaba_Cloud_Migration_Tool.zip Archive: Alibaba_Cloud_Migration_Tool.zip inflating: Inflating go2aliyun_client1. 2.5 _linux. Zip: go2aliyun_client1. 2.5 _windows. ZipCopy the code
Decompress the Linux toolkit:
Unzip go2aliyun_client1. 2.5 _linux. Zip CD go2aliyun_client1. 2.5 _linux /Copy the code
There are two directories in the directory:
[root @ VM_199_173_centos go2aliyun_client1. 2.5 _linux] # ls go2aliyun_client1. 2.5 _linux_i386 Go2aliyun_client1. 2.5 _linux_x86_64Copy the code
I386 is 32-bit, x86_64 is 64-bit, but the default server is 64-bit, so we go to go2aliyun_client1.2.5_linux_x86_64.
CD o2aliyun_client1. 2.5 _linux_x86_64Copy the code
configuration
Json file, which is a JSON configuration file
{
"access_id ": " ",
"secret_key ": " ",
"region_id ": " ",
"image_name ": " ",
"system_disk_size ": 40,
"platform ": " ",
"architecture ": " ",
"data_disks ": [],
"bandwidth_limit ": 0
}Copy the code
Specific parameters:
Parameter names | type | If required | instructions |
---|---|---|---|
access_id | String | is | The API access key AccessKeyID of your Aliyun account. For more details, please refer toTo create the Access Key. |
secret_key | String | is | The API access key of your Aliyun account AccessKeySecret. For more details, please refer toTo create the Access Key. |
region_id | String | is | Migrate your server to ali Cloud region ID, such ascn-hangzhou (East China 1), for referenceHelp.aliyun.com/document_de…L “data-spm-anchor-id=” a2C4g.11186623.2.28″ > Region and available area. |
image_name | String | is | Set an image name for your server image that cannot duplicate the name of an existing image in the same locale.
|
system_disk_size | int | is | Specifies the size of the system disk, in GB. Value range:
|
platform | String | no | Operating system of the source server. Value range:
parameter |
architecture | String | no | System architecture. Value range:
|
bandwidth_limit | int | no | Upper limit of data transmission bandwidth, expressed in KB/s. Default value: 0 |
data_disks | Array | no | List of data disks. A maximum of 16 data disks are supported. For specific parameters, seeData disk configuration parameters. This parameter can be set to the expected value of the data disk. The unit is GB. The value cannot be smaller than the actual space used by the data disk. |
For details about data disks, see:
Help.aliyun.com/document_de…
{
"access_id": "LTAIXeadwww.mf8.biz",
"secret_key": "VHVQ1Tzwww.mf8.bizvH8pIMoMSA",
"region_id": "cn-shanghai",
"image_name": "MF8-BIZ-QIANYUN-IMAGE-001",
"system_disk_size": 50,
"platform": "CentOS",
"architecture": "x86_64",
"data_disks": [],
"bandwidth_limit": 0
}Copy the code
The platform must be case-sensitive!
Directories in rsynC_EXCLUDES_linux.txt are not migrated to avoid unnecessary space waste, so we can add unnecessary directories in it.
The migration
CD /root/go2aliyun_client1.2.5_linux/go2aliyun_client1.2.5_linux_x86_64 chmod +x./go2aliyun_client./go2aliyun_clientCopy the code
A temporary volume ECS synchronization for the selected region is then automatically created, and when the synchronization is complete a snapshot is automatically created and created as a custom mirror.
Then we don’t have to worry about anything, just make a cup of coffee and take a nap.
Enter any key to Exit… That means we’re done migrating.
In the snapshot list, you can see the snapshot created:
Of course, the ECS will eventually be created using the custom mirror created from this snapshot.
detection
My architecture itself is very simple, basically as long as it can open Nginx, other complex architectures may need to be carefully checked to see if it works.