使用 Migrate for Compute Engine 工具AWS迁移到GCP(谷歌云平台)

产品介绍:

适合任何企业的企业级流畅迁移

云迁移会产生许多问题。Google Cloud 支持的 Migrate for Compute Engine 可为您提供解决方案。无论是从本地迁移一个应用,还是迁移来自多个数据中心的上千个企业级应用,Migrate for Compute Engine 可帮助任何规模的 IT 团队将工作负载迁移到 Google Cloud。

快速高效的迁移

借助 Cloud Console 中 Migrate for Compute Engine 简单易用的“服务化”界面和灵活的迁移选项,任何人都可以轻松减少迁移通常需要耗费的时间和繁复的工作。避免复杂的部署、设置和配置。无需使用复杂和麻烦的客户端迁移工具代理。通过使用正确的迁移工具,您可以将迁移团队的宝贵时间留给最重要的工作:迁移工作负载。

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_1.pngoutput_1

轻松简单的大规模迁移

利用 Migrate for Compute Engine 的速度、规模和灵活性来加速迁移计划。只需点击几下即可迁移单个应用,使用组可执行包含 100 个系统的迁移 Sprint,还可以使用我们的 Cloud API 构建您自己的内部迁移控制中心。Migrate for Compute Engine 可帮助您以最适合自己的方式自定义迁移。

极少的停机时间和风险

内置的测试功能可让您在迁移之前快速轻松地进行验证。没有客户端软件代理意味着不会对工作负载本身所需的资源产生影响,也不需要开放对运行工作负载的网络的访问权限(或者从该网络访问外部的权限),并且完全无需源系统运行即可完成迁移。您可以定期将数据从源工作负载复制到目标位置,无需手动执行步骤或中断正在运行的工作负载,从而最大限度地缩短工作负载停机时间,实现快速的云割接。

更低费用,更高效率

Migrate for Compute Engine 的“服务化”模式有助于减少迁移工作量和复杂性。其速度和简易性有助于降低高昂的本地硬件和软件许可成本。此外,Migrate for Compute Engine 提供基于用量的分析功能,帮助您合理调整目标实例的大小并避免云端过度预配。

部署安装文档

https://cloud.google.com/migrate/compute-engine/docs/4.11/how-to/migrate-aws-to-gcp/overview?hl=zh-cn

https://cloud.google.com/migrate/compute-engine/docs/4.11/getting-started?hl=zh-cn

迁移以使用 Compute Engine 架构

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_2.pngoutput_2

https://cloud.google.com/migrate/compute-engine/docs/4.11/concepts/architecture/gcp-reference-architecture

1. VPN 设置

AWS 和 GCP 环境之间需要设置一个VPN通道

1.1 GCP设置VPC(创建vpc)

名称随意,然后按照下图所示输入信息(区域按照自己的需要选择),其余默认

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_3.pngoutput_3

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_4.pngoutput_4

命令执行;

gcloud compute networks create aws-gcp-vpc –project=mec-test-344202 –subnet-mode=custom –mtu=1460 –bgp-routing-mode=global

gcloud compute networks subnets create aws-gcp-subnet-test –project=mec-test-344202 –range=172.16.0.0/16 –stack-type=IPV4_ONLY –network=aws-gcp-vpc –region=asia-east2 –enable-private-ip-google-access

1.2 创建外部IP (需要创建一个外部IP(区域选择和VPC一样的),用于aws设置网关)

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_5.pngoutput_5

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_6.pngoutput_6

1.3 AWS设置VPC (填入信息创建vpc并创建子网其余默认)

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_7.pngoutput_7

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_8.pngoutput_8

1.4 创建客户网关 (输入名称和在GCP创建的IP地址)

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_9.pngoutput_9

1.5 创建并设置虚拟私有网关

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_10.pngoutput_10

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_11.pngoutput_11

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_12.pngoutput_12

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_13.pngoutput_13

1.6 创建站点到站点VPN连接

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_14.pngoutput_14

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_15.pngoutput_15

1.7下载vpn配置文件,GCP配置VPN密钥 (下载备份配置文件后续会用到,请记住保存路径

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_16.pngoutput_16

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_17.pngoutput_17

1.8 AWS 创建并配置路由表

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_18.pngoutput_18

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_19.pngoutput_19

1.9创建完成后配置路由表:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_20.pngoutput_20

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_21.pngoutput_21

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_22.pngoutput_22

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_23.pngoutput_23

1.10 添加子网关联:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_24.pngoutput_24

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_25.pngoutput_25

1.11 GCP配置VPN

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_26.pngoutput_26

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_27.pngoutput_27

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_28.pngoutput_28

远程对接ip :aws 客户网关地址

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_29.pngoutput_29

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_30.pngoutput_30

1.12 检查VPN连接

Aws :

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_31.pngoutput_31

GCP:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_32.pngoutput_32

1.13通过虚拟机之间相互ping来验证VPN

设置AWS安全组的入站规则:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_33.pngoutput_33

设置GCP 防火墙规则:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_34.pngoutput_34

AWS 虚拟机 ping GCP 机器

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_35.pngoutput_35

GCP ping AWS

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_36.pngoutput_36

配置防火墙规则;

1.14配置防火墙规则

按照下图配置GCP防火墙规则(AWS VPC CIDR 范围为 10.20.0.0/16,GCP VPC CIDR 范围为 172.16.0.0/16

Firewall rule Description Target tag Source tag/IP Protocol/Ports
Allow-aws-connection(optional) AWS to GCP VPC Apply to all AWS VPC CIDR Range all
velos-ce-backend Encrypted migration data sent from

Velostrata Backend to Cloud Extensions.

fw-velostrata AWS VPC CIDR Range tcp:9111
velos-ce-control Control plane between Cloud Extensions

and Velostrata Manager.

fw-velostrata fw-velosmanager tcp:443,

9111

velos-ce-cross Synchronization between Cloud Extension

nodes.

fw-velostrata fw-velostrata all
velos-console-probe Allows the Velostrata Manager to check if

the SSH or RDP console on the migrated VM is available.

fw-workload fw-velosmanager tcp:22,3389
velos-manager-ssh To access velo-manager fw-velosmanager Your Public IP(for ssh purpose),AWS VPC

CIDR Range

tcp:22
velos-webui HTTP & HTTPS access to Velostrata

Manager for web UI.

fw-velosmanager AWS VPC CIDR Range,

GCP VPC CIDR Range,

Your Public IP(for accessing velostrata

UI)

tcp:443,80
velos-workload migrated workloads → velos edge for

migration & syslog

fw-velostrata fw-workload tcp:3260

udp:514

workload-rdp-ssh-allow migrate workload access fw-workload Your Public IP(for ssh & RD purpose),

AWS VPC CIDR Range

tcp:22,3389

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_37.pngoutput_37

2.创建和配置迁移管理器

控制台看不到这个页面需要去文档跳转;

https://cloud.google.com/migrate/compute-engine/docs/4.11/how-to/configure-manager/configuring-migration-manager?hl=zh-cn

需要创建角色:https://cloud.google.com/migrate/compute-engine/docs/4.11/how-to/configuring-gcp/configuring-gcp-manually?hl=zh-cn

开启api 接口

gcloud services enable iam.googleapis.com –project mec-test-344202

gcloud services enable cloudresourcemanager.googleapis.com –project mec-test-344202

gcloud services enable compute.googleapis.com –project mec-test-344202

gcloud services enable storage-component.googleapis.com –project mec-test-344202

gcloud services enable logging.googleapis.com –project mec-test-344202

gcloud services enable monitoring.googleapis.com –project mec-test-344202

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_38.pngoutput_38

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_39.pngoutput_39

给予服务账号权限;

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/cloudmigration.inframanager” \

–no-user-output-enabled –quiet

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/cloudmigration.storageaccess” \

–no-user-output-enabled –quiet

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/iam.serviceAccountUser” \

–no-user-output-enabled –quiet

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/logging.logWriter” \

–no-user-output-enabled –quiet

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/monitoring.metricWriter” \

–no-user-output-enabled –quiet

gcloud projects add-iam-policy-binding mec-test-344202 –member \

serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role “roles/monitoring.viewer” \

–no-user-output-enabled –quiet

gcloud iam service-accounts add-iam-policy-binding \

“migration-manager@mec-test-344202.iam.gserviceaccount.com” \

–member=serviceAccount:”328842067835-compute@developer.gserviceaccount.com” \

–role=roles/iam.serviceAccountTokenCreator –project mec-test-344202

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_40.pngoutput_40

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_41.pngoutput_41

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_42.pngoutput_42

3 aws 创建客户端

3.1 下载客户端文件:https://cloud.google.com/migrate/compute-engine/docs/4.11/resources/downloads

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_43.pngoutput_43

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_44.pngoutput_44

3.2 在AWS控制台找到Cloud Formation,创建堆栈:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_45.pngoutput_45

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_46.pngoutput_46

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_47.pngoutput_47

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_48.pngoutput_48

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_49.pngoutput_49

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_50.pngoutput_50

3.3 创建IAM用户并加入VelosMgrGroup组

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_51.pngoutput_51

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_52.pngoutput_52

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_53.pngoutput_53

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_54.pngoutput_54

第三步跳过;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_55.pngoutput_55

4.虚拟机安装客户端

参考文档:

https://cloud.google.com/migrate/compute-engine/docs/4.11/how-to/prepare-vms-servers/preparing-linux-vms#amazon-linux

登录Linux虚拟机,逐条执行以下命令:

wget https://storage.googleapis.com/velostrata-release/4.11.9/migrate-for-gce-prep-4.11.9-0.deb

sudo apt-get update

sudo apt –fix-broken install

sudo apt install multipath-tools*

sudo apt-get update && sudo apt-get install -f -y

sudo dpkg -i migrate-for-gce-prep-4.11.9-0.deb

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_56.pngoutput_56

5.迁移过程;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_57.pngoutput_57

5.1 仍然使用apiuser这个用户名和对应的密码登录,登录进来后选择“YES”启用StackDriver日志:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_58.pngoutput_58

5.2 设置源云

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_59.pngoutput_59

5.3 此处的两个key,在3.2章节最后的一张图中下载的文件,打开文件即可看;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_60.pngoutput_60

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_61.pngoutput_61

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_62.pngoutput_62

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_63.pngoutput_63

5.4 配置目标云;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_64.pngoutput_64

5.5 创建云扩展,将创建2个需要500 GB SSD卷的VM。因此,请确保已将项目配额增加到至少 1 TB,查询方法:谷歌云控制台-IAM和管理-配额-SSD,如图:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_65.pngoutput_65

5.6 开始创建云拓展,最后一项选择有权限创建VM的服务器账号:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_66.pngoutput_66

5.7 接下来编辑“Cloud Extension”,最后一项当迁移的虚拟机数量少于或等于15台时选择“Small”,大于15台时选择“Large”:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_67.pngoutput_67

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_68.pngoutput_68

5.8 创建云拓展完成后,可以在谷歌云控制台-虚拟机实例看到两台刚创建好的边缘节点:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_69.pngoutput_69

5.9 分别点进去开启HTTP和HTTPS防火墙:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_70.pngoutput_70

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_71.pngoutput_71

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_72.pngoutput_72

5.10 设置迁移波

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_73.pngoutput_735.11AWS 实例打标签;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_74.pngoutput_74

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_75.pngoutput_75

5.12 单击“创建”按钮后,将下载一个 CSV 文件,其中包含要迁移的 AWS VM 的所有详细信息(如果文件内没有内容,请给虚拟机增加上图对应的标签后重试):

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_76.pngoutput_76

5.13 打开文件,修改三个地方后保存:

  1. ①去掉第一列的“-“号;
  2. ②选择迁移到GCP后的实例类型;
  3. ③为实例命名。

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_77.pngoutput_77

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_78.pngoutput_78

创建wave:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_79.pngoutput_79

5.14 需要手动验证;

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_80.pngoutput_80

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_81.pngoutput_81

5.15 验证成功好才可以创建新作业:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_82.pngoutput_82

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_83.pngoutput_83

5.16 点击上图“Start”,迁移就会进行,点击监控可以看到进度(约40分钟

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_84.pngoutput_84

5.17 分离托管

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_85.pngoutput_85

5.18 创建GCE 机器后添加外部IP

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_86.pngoutput_86

5.19远程连接GCP 的新服务器;(aws 设置了密码登录)

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_87.pngoutput_87

5.20 Windows虚拟机在本地用远程工具打开AWS的虚拟机,下图以Windows2019为例:

下载GCPpowershell模块

Migrate for Compute Engine Downloads | Google Cloud

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_88.pngoutput_88

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_89.pngoutput_89

安装完成后,用管理员身份运行Windows PowerShell

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_90.pngoutput_90

复制以下命令到PowerShell运行:

Import-Module Velostrata.PowerShell

Connect-VelostrataManager

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_91.pngoutput_91

接下来需要登录GCP的迁移管理器,Server为迁移管理器的内部IP(参考2.2章节的最后一张图);Username为”apiuser”,Password是前面创建并保存的(参考2.2章节的倒数第三张图)。

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_92.pngoutput_92

复制以下命令到Powershell执行,会下载所需的安装包,按提示输入“Y”或者直接回车:

Get-help Connect-VelostrataManager

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_93.pngoutput_93

迁移到GCP 添加公网使用工具登录虚拟机,(使用迁移vm的账号和密码)

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_94.pngoutput_94

补充:5.21 参考 5.11 5.12 5.13 步骤

AWS LINUX

按照以下步骤准备 Amazon Linux 或 Amazon Linux 2。(只支持离线迁移)

注意:Amazon Linux 不支持运行测试克隆。

  1. 通过运行 grep -i virtio /boot/config-$(uname -r) 来检查内核是否包含 virio。如果没有结果,则表示 virtio 驱动程序缺失并且需要安装。
  2. 修改 /etc/dracut.conf.d/ec2.conf 并注释掉以下行

omit_dracutmodules+=”dm dmraid i18n plymouth crypt lvm mdraid qemu terminfo kernel-modules”

修改 /etc/dracut.conf 添加以下行:

add_drivers+=”virtio virtio_scsi virtio_net”

取消备注 hostonly=yes 行,并将值更改为 no

hostonly=n

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_95.pngoutput_95

运行 dracut -f -v 以重新构建 initrd。

dracut -f -v

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_96.pngoutput_96

运行 lsinitrd /boot/initramfs-$(uname -r).img | grep virtio 以确认 initrd 包含 VirtIO 驱动程序。

lsinitrd /boot/initramfs-$(uname -r).img | grep virtio

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_97.pngoutput_97

查看内核:如果要迁移 Linux AMI,请使用 DIST=6 运行以下命令;如果要迁移具有内核 4.x 的 Amazon Linux 2,请使用 DIST=7 运行以下命令;如果要迁移具有内核 5.x 的 Linux 2,请使用 DIST=8 运行以下命令:

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_98.pngoutput_98

sudo tee /etc/yum.repos.d/google-cloud.repo << EOM

[google-cloud-compute]

name=Google Cloud Compute

baseurl=https://packages.cloud.google.com/yum/repos/google-compute-engine-el7-x86_64-stable

enabled=1

gpgcheck=1

repo_gpgcheck=0

gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg

https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

EOM

更新软件包列表:

sudo yum makecache

sudo yum updateinfo

安装访客环境软件包:

sudo yum install -y google-compute-engine

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_99.pngoutput_99

sudo yum install -y google-compute-engine

yum install -y python

yum install -y google-compute-engine python-google-compute-engine

yum install -y google-osconfig-agent

/private/var/folders/pv/p2x28x1914zg7_r74h0jp00m0000gn/T/com.kingsoft.wpsoffice.mac/picturecompress_20221110143332/output_100.pngoutput_100

问题总结:注意防火墙策略精确到端口,GCP 创建服务账号的权限;

Migrate for Compute Engine 工具支持迁移区域支持;vus esar(北弗吉尼亚洲)美国西部(北加州,俄勒冈州)加拿大(中部)欧盟(爱尔兰,伦敦,法兰克)亚太(新加坡,悉尼,东京,孟买,首尔,)南美洲(圣保罗)

迁移到GCP的虚拟机在GCP 使用控制台ssh 不能登录(原因在排查中)

排查思路:

[1] https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh

[2] https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh

#linux_errors > “您使用了第三方工具进行连接,并且 SSH 命令配置有误。”

[3] https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh

#linux_errors > “使用存储在 OS Login 配置文件中的 SSH 密钥连接到未启用 OS Login 的虚拟机。”

[4] https://cloud.google.com/compute/docs/oslogin/set-up-oslogin#enable_oslogin

[5] https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh#reqs

[6] https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh#run_the_troubleshooting_tool

问题补充:aws 迁移到GCP 建议使用用户和密码登录,迁移到GCP 实例无法自动创建用户,所以导致无法登录服务器。(服务迁移到GCP的环境是一样的);

发表评论

您的电子邮箱地址不会被公开。