Alibaba Cloud の国際サイトへの移行 #2

日本サイトでホストしている本サイト(https://bigriver.jp/)を国際サイトへ移行します。 SMC(Server Migration Center)を使って実際に移行する手順を紹介します。 

今回は3つの記事の2番目となります。

1. 事前準備

事前準備としてAlibaba Cloud の国際アカウント側で以下を実施します。 

  1. Alibaba Cloud 国際サイトのアカウント開設
  2. 国際サイトでSMC を有効化
  3. 国際サイトでRAM を有効化
  4. 国際サイトでAccess Key を生成

具体的な手順は割愛しますが詳しくは以下のマニュアルを参照してください。

https://www.alibabacloud.com/help/doc-detail/122993.htm

事前準備後の移行作業の流れは以下になります。

smc2
https://www.alibabacloud.com/help/doc-detail/122975.htm

2. SMCクライアントのインストール

以下のマニュアルに従いSMC クライアントをインストールします。

https://www.alibabacloud.com/help/doc-detail/122992.htm

2.1. SMC クライアントのダウンロード

移行元のホストにログインしモジュールをダウンロードします。

# wget http://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/Alibaba_Cloud_Migration_Tool.zip

ZIPファイルを展開します。ダウンロードしたZIPを展開すると

# unzip Alibaba_Cloud_Migration_Tool.zip
Archive: Alibaba_Cloud_Migration_Tool.zip
inflating: go2aliyun_client2.0.5_linux_i386.zip
inflating: go2aliyun_client2.0.5_linux_x86_64.zip
inflating: go2aliyun_client2.0.5_windows_i386.zip
inflating: go2aliyun_client2.0.5_windows_x86_64.zip
inflating: Release Note.txt

展開後、再度、今回利用するプラットフォームに応じたZIPファイルを展開します。 ” go2aliyun_client2.0.5_linux_x86_64.zip ”を展開します。

# unzip go2aliyun_client2.0.5_linux_x86_64.zip

2.2. SMC クライアントのインストール

Linux では特にインストールは不要です。 展開されたプログラムを直接実行します。 ただ、実行権を付与する必要があります。

# cd go2aliyun_client2.0.5_linux_x86_64/
# chmod +x go2aliyun_client

参考までに”go2aliyun_client”はバイナリです。

# file go2aliyun_client
go2aliyun_client: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.18, with debug_info, not stripped

3. SMC クライアントの実行

それではSMC クライアントを実行します。

# ./go2aliyun_client
[2020-03-21 23:49:52] [Info] ========= Goto Aliyun Client 2.0.5. =========
[2020-03-21 23:49:52] [Info] ========= Run In Daemon Mode =========
[2020-03-21 23:49:52] [Info] Goto Aliyun Begin…
[2020-03-21 23:49:52] [Info] Load User Config…
Please Enter Access Id: <Access Id を入力>
Please Enter Secret Key: <Secret Key を入力>
[2020-03-21 23:51:06] [Info] Load Client Data…
[2020-03-21 23:51:06] [Info] Check System Info [Ubuntu x86_64]…
OS Info: Ubuntu 18.04.3 LTS (4.15.0-72-generic)
CPU Info: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
CPU Usage: 2 Cores (0.00%) Memory Usage: 3.73GB/4.00GB (93.25%)
Hostname: bigriver2 IP Address: 172.24.214.208 Mac Address: 00163E003CF9
[2020-03-21 23:51:07] [Info] Verify User Account…
Your Account Hasn’t Authorized For SMC RAM Role. Please Authorize It.[2020-03-21 23:51:08] [Warn] Goto Aliyun Not Finished! See Details Info In Log File [/root/go2aliyun_client2.0.5_linux_x86_64/Logs/go2aliyun_client_20200321.log].
Get More Help From Online Docs:
(Chinese) https://help.aliyun.com/document_detail/122975.html
(International) https://www.alibabacloud.com/help/product/121538.htm
You Can Try Again After The Problem Is Solved.

”Verify User Account”のフェーズで失敗しました。

Your Account Hasn’t Authorized For SMC RAM Role. ”とのことでRAMユーザの権限が不足しているようです。

SMCへの権限の付与が漏れていたようですので実行します。詳細は以下のマニュアル参照。

https://www.alibabacloud.com/help/doc-detail/122993.htm

再実行します。 また失敗です。

# ./go2aliyun_client
[2020-03-21 23:58:45] [Info] ========= Goto Aliyun Client 2.0.5. =========
[2020-03-21 23:58:45] [Info] ========= Run In Daemon Mode =========
[2020-03-21 23:58:45] [Info] Goto Aliyun Begin…
[2020-03-21 23:58:45] [Info] Load User Config…
[2020-03-21 23:58:45] [Info] Load Client Data…
[2020-03-21 23:58:45] [Info] Check System Info [Ubuntu x86_64]…
OS Info: Ubuntu 18.04.3 LTS (4.15.0-72-generic)
CPU Info: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
CPU Usage: 2 Cores (1.00%) Memory Usage: 3.73GB/4.00GB (93.25%)
Hostname: bigriver2 IP Address: 172.24.214.208 Mac Address: 00163E003CF9
[2020-03-21 23:58:46] [Info] Verify User Account…
Your Account Hasn’t Completed The Real Name Authentication. Please Check It.[2020-03-21 23:58:47] [Warn] Goto Aliyun Not Finished! See Details Info In Log File [/root/go2aliyun_client2.0.5_linux_x86_64/Logs/go2aliyun_client_20200321.log].
Get More Help From Online Docs:
(Chinese) https://help.aliyun.com/document_detail/122975.html
(International) https://www.alibabacloud.com/help/product/121538.htm
You Can Try Again After The Problem Is Solved.
Enter any key to exit…

” Your Account Hasn’t Completed The Real Name Authentication. ” とのことで、実名認証が必要とのこと。

マニュアルでは以下の記載の通りで中国本土サーバーへの移行には実名認証が必要と読めたので不要だと思ったのですが。。。

To migrate servers to mainland China, ensure that you have completed real-name verification.The verification methods are as follows:

  • Method 1: Go to the real-name verification page to complete verification.
  • Method 2: Log on to the SMC console. If you have not completed real-name verification, the console will prompt you to do so.

実名認証を実施します。 アカウント情報の”Real-name Registration”からパスポート情報を登録します。

必要情報を入力し、送信します。 1から2日かかるようです。

とりあえず、登録を待ちます。 実名認証が完了後にSMCによる移行を再実行します。

実名認証は1-2日程度で終わりました(通知等なく確認したら終わっていた)。

再度移行のコマンドを実行します。

# ./go2aliyun_client
[2020-04-04 13:54:16] [Info] ========= Goto Aliyun Client 2.0.5. =========
[2020-04-04 13:54:16] [Info] ========= Run In Daemon Mode =========
[2020-04-04 13:54:16] [Info] Goto Aliyun Begin…
[2020-04-04 13:54:16] [Info] Load User Config…
[2020-04-04 13:54:16] [Info] Load Client Data…
[2020-04-04 13:54:16] [Info] Check System Info [Ubuntu x86_64]…
OS Info: Ubuntu 18.04.3 LTS (4.15.0-72-generic)
CPU Info: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
CPU Usage: 2 Cores (0.50%) Memory Usage: 3.64GB/4.00GB (91.00%)
Hostname: bigriver2 IP Address: 172.24.214.208 Mac Address: 00163E003CF9
[2020-04-04 13:54:18] [Info] Verify User Account…
[2020-04-04 13:54:19] [Warn] Your Account Hasn’t Opened Snapshot Service. Please Open it.
[2020-04-04 13:54:19] [Info] Generate SSH Key…
[2020-04-04 13:54:19] [Info] Import Source Server…
[2020-04-04 13:54:20] [Info] Import Source Server [s-bp11748xdnl0rf1v0o19] Successfully!
[2020-04-04 13:54:26] [Info] Check Source Server Status…
[2020-04-04 13:54:27] [Info] Check Replication Job Status…
Wait For New Job To Start, time: 3m40s –

”Wait For New Job To Start, time: XXX”とのことで待っていたらSSH接続が切れてしまいました。 もう一度接続し、プロセスを確認します。 プロセスは動いています。

# ps -ef |grep go2
root 20178 20149 0 13:54 pts/0 00:00:00 ./go2aliyun_client

移行先となる国際サイト側でSMC コンソールを確認します。 認識されています。 前回失敗したアカウントの実名認証は無事クリアしたようです。

”Migration Source Statuses”から”1″をクリックします。 移行するサーバが確認できます。

また、上部のほうに警告が出ています。 ECSのSnapshot 機能を有効化しなさいとのこと。 日本サイトでは無償で利用出来ていたのですが国際サイトは有償化にともなって有効化しないといけないということなのだと思います。

”You have activated the snapshot service (Currently, you have not activated the snapshot service).Activate”

あと、何故かAlibaba Cloud のWebコンソールが白黒になっている。。。 何か悪いことをしたのか(した記憶はないが)。 とりあえず進めます。

4. Snapshot の有効化

SMCで利用するために必須ということでSnapshotを有効化します。

ECSのスナップショット管理画面に移動します。

自動スナップショットポリシーのタブに移動し、”ポリシーを作成”をクリックします。

”OK”をクリックします。


スナップショットポリシーを作成後、再度SMC管理画面にアクセスします。

上部に表示されていたSnapshotに関する警告は解消されました。

ここまでの操作で国際サイトのSMCに移行元の日本サイトのサーバが登録された状態となります。次に実際のデータのコピーなどが走るMigration Task の実行に進みます。

5. Migration Task の実行

SMC コンソールからタスクを実行します。

マニュアルは以下。

https://www.alibabacloud.com/help/doc-detail/123141.htm

Actions にある”Create Migration Task”を実行します。

必要最低限の情報を入力し実行してみます。

失敗します。 ”The Migration Source status is invalid”とのことで、移行元の状態に何か原因がありそうです。

SMC コンソールで状態を確認します。 Statusが”inactive”になっています。

移行元のサーバを核にするとgo2aliyun_client のプロセスが動いていません。再度go2aliyun_clientコマンドを実行し、SMC コンソールから”Creation Migrate Task”を実行します。 今度は成功しました。 

SMCコンソールのタスク画面から状況を確認できます。

”View logs”をクリックするとログも確認出来ます。

移行元サーバでも進捗を確認できます。 一番最後の行に進捗が%(Percentage)とデータ量で確認できます。

# ./go2aliyun_client
[2020-04-04 14:41:21] [Info] ========= Goto Aliyun Client 2.0.5. =========
[2020-04-04 14:41:22] [Info] ========= Run In Daemon Mode =========
[2020-04-04 14:41:22] [Info] Goto Aliyun Begin…
[2020-04-04 14:41:22] [Info] Load User Config…
[2020-04-04 14:41:22] [Info] Load Client Data…
[2020-04-04 14:41:22] [Info] Check System Info [Ubuntu x86_64]…
OS Info: Ubuntu 18.04.3 LTS (4.15.0-72-generic)
CPU Info: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
CPU Usage: 2 Cores (0.50%) Memory Usage: 3.59GB/4.00GB (89.75%)
Hostname: bigriver2 IP Address: 172.24.214.208 Mac Address: 00163E003CF9
[2020-04-04 14:41:23] [Info] Verify User Account…
[2020-04-04 14:41:24] [Info] Import Source Server…
[2020-04-04 14:41:25] [Info] Import Source Server [s-bp11748xdnl0rf1v0o19] Successfully!
[2020-04-04 14:41:28] [Info] Check Source Server Status…
[2020-04-04 14:41:29] [Info] Check Replication Job Status…
Wait For New Job To Start, time: 1m0s –
[2020-04-04 14:42:30] [Info] Replication Job [j-6we1748xdnl0s0r764jf] Is Started.
Stage(0/3) Job: Running (Preparing), Progress: 5.00%, time: 1m10s \
[2020-04-04 14:44:12] [Info] Connecting to Transition Instance (wait 600s max)…
Stage(0/3) Connect count: 1, time: 0s
[2020-04-04 14:44:12] [Info] Connect to Transition Instance Successfully!
[2020-04-04 14:44:13] [Info] Init Transition Disk 0 (wait 1800s max)…
Stage(0/3) Wait count: 3, time: 9s
[2020-04-04 14:44:23] [Info] Prepare To Transfer Disk 0…
[2020-04-04 14:44:23] [Info] Transfer Testing (wait 300s max)…
Stage(1/3) Transfer Test count: 1, time: 0s
[2020-04-04 14:44:23] [Info] Transfer Test Successfully!
Stage(1/3) Transfer Size: 771.58MB, progress: 7.46%, time: 2m21s |

最終的には以下のログとともにタスクの成功を確認できます。

Stage(2/3) Job: Running (Processing), Progress: 75.00%, time: 18m23s \
Stage(2/3) Job: Running (Processing), Progress: 75.00%, time: 20m25s \
Stage(2/3) Job: Running (Processing), Progress: 81.40%, time: 21m26s /
Stage(2/3) Job: Running (Processing), Progress: 89.24%, time: 22m57s –
Stage(2/3) Job: Finished, Progress: 100.00%, time: 25m0s – 29s \
Stage(3/3) Job: Finished, Progress: 100.00%, time: 25m30s
[2020-04-04 15:08:00] [Done] Replication Job [j-6we1748xdnl0s0r764jf] Is Finished!
[2020-04-04 15:08:00] [Done] Create Target Image [m-6wehe99jnl1wxqjcead3] Successfully!
[2020-04-04 15:08:00] [Info] Generate SSH Key…
[2020-04-04 15:08:00] [Info] Import Source Server…
[2020-04-04 15:08:01] [Info] Import Source Server [s-bp11748xdnl0rf1v0o19] Successfully!
Wait For New Job To Start, time: 1s |

SMC コンソールからも確認出来ます。

最終的にカスタムイメージが出来上がっていればSMC による作業は終了です。 実際のECS の作成はこのカスタムイメージから通常と同じ手順で実施します。

次の記事では出来上がったカスタムイメージからECS を作成します。