Online Migration For Linux
Created#More Posted time:May 17, 2016 10:54 AM
Table of Contents
This document introduce a method on how to migrate a image from EC2 to ECS. And what's the OS type we already support.
Before we do the experiment, we should have a couple of instances with equivalent OS release version on both side of Cloud providers.
Make sure that the instances are accessible to the Internet.
3. Migrating Steps
In our experiment, we launched two instances, one is an EC2(54.2000.102.210) as a source, another is ECS(126.96.36.199) as the target instance.
This experiment is aim to migrate the exist system from EC2 to ECS.
Firstly, we should authorize root to login to the EC2 instance.
One method is to config the /etc/ssh/sshd_config file by uncomment these two options to allow root to login by password.
#Find and uncomment this two lines
Save the file and quit.
Then set the root password:
If you have been running your applications on your EC2, please top them before the migration.
Secondly, ssh to ECS and install dependencies and migration tool:
apt-get install rsync
Download the ready migrate tool to /tmp and execute command.Ask me to get the migration tool.
In the experiment, I already scp the migrate tool to /tmp/migrate_tool and make it executable.
chmod +x migrate
root@iZu1e533scsZ:/tmp/migrate_tool# ./migrate migrate 188.8.131.52
[Thu Jan 14 12:13:22 UTC 2016] [INFO] "begin to prepare"
The authenticity of host '184.108.40.206 (220.127.116.11)' can't be established.
ECDSA key fingerprint is 7c:3b:7d:43:cf:5a:2c:2e:2d:e2:e5:05:31:bd:4d:c7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '18.104.22.168' (ECDSA) to the list of known hosts.
After enter your password of EC2 root, the migrating tool will transfer all files of system disk on EC2 except for the run-time files.
sent 277,016,651 bytes received 161,051 bytes 17,882,432.39 bytes/sec
total size is 1,194,098,631 speedup is 4.31
[Thu Jan 14 12:17:00 UTC 2016] [INFO] "end of migrate"
[Thu Jan 14 12:17:00 UTC 2016] [INFO] "begin to postcheck"
[Thu Jan 14 12:17:04 UTC 2016] [INFO] "end of postcheck"
After migration task has done, the progresses INFOs will be print on stdout.
And in one case, postcheck finally ends with prompt 'failed to re-install grub, you must do it manually'
Then we execute this command to finish the migration:
grub-install /dev/xvda >/dev/null 2>&1
For the cases of some versions of CentOS(7uX) you should run by grub2-install instead.
Moreover, the program will put it's log file in /tmp which named aliyun_migrate.log
At last, resume your applications and do the verification.
Auto check the version of grub-install tool and choose the right one to execute.
5. Planed Improvement
1st Reply#Posted time:Nov 15, 2017 16:56 PM
where did you download the migration tool from?