この記事の最終目的
オンプレミスのCentOS5世代の環境をそのままAWSに移設する必要が出てきた。この機会にCloudEndureを試してみる
CentOS5は対象なの?
https://docs.cloudendure.com/Content/Getting_Started_with_CloudEndure/Supported_Operating_Systems/Supported_Operating_Systems.htm
条件付き(Nitoroインスタンスが使えないとか)で行けるっぽい。やった!
作業に当たっての参考
AWS公式
https://aws.amazon.com/jp/cloudendure-migration/
クラスメソッド様のhowto記事
https://dev.classmethod.jp/articles/cloudendure-no-charge/
こちらにたいへんよくまとまっているのでまずは通読してから作業
【作業概要】
やってみた
1)CloudEndureサービスへのサインアップ
Sign up for your CloudEndure account
https://console.cloudendure.com/#/register/register
→メール経由でID/PWを承認
2)CloudEndureの管理画面で初期設定
AWSでCloudEndureが提示するポリシーを作成し、専用のIAMにアタッチします
- ポリシーの作成
[create policy] -[JSON]
ポリシーは以下の中身をそのまま貼り付けます。
https://docs.cloudendure.com/Content/IAMPolicy.json
(CloudEndure管理画面左ペインの[Stup & Info]-[AWS CREDENTIALS]のThe Project must have these permissionsのリンク先)
- IAMの作成
専用のIAM Userを作成し、上記ポリシーをアタッチします
UserNmae: CloudEndure アクセスの種類:プログラムによるアクセス
→アクセスキーが発行されますので、これをCloudEndureに登録しましょう。
- CloudENdureの管理画面
CloudEndureの管理画面にサインインします
https://console.cloudendure.com/#/signIn
CloudEndure管理画面左ペインの[Stup & Info]-[AWS CREDENTIALS]でアクセスキーとシークレットアクセスキーを設定します。
3)レプリケーションの設定(1)レプリケーションサーバの用意
CloudEndure管理画面左ペインの[Stup & Info]-[REPRICATION SETTINGS]でレプリケーション設定を行います。
Migration Source:Other Infrastructure Migration Target:AWS Asia Pacific(Tokyo) Choose the Replication Server instance type:t3.micro Choose the subnet where the Replication Servers will be launched:任意のサブネット
上記で[SAVE REPLICATION SETTINGS]
4)レプリケーションの設定(2)移行元にエージェントのインストール
CloudEndure管理画面左ペインの[Machines]-[AddMachines]でAgentインストール用のコマンドが得られます。
For Linux machines Download the CloudEndure Agent Installer for Linux: wget -O ./installer_linux.py https://console.cloudendure.com/installer_linux.py sudo python ./installer_linux.py -t <付与されたトークン> --no-prompt
このコマンドをそのままレプリケーション元のサーバで実行します。
※今回検証時にはEventlogに
agentInstallFailed Failed to install agent on machineエラーが出ました。
cloudendure.logによればgccが入っていなかったのが原因だったので、gccをインストールしています。
※末尾にCentOS5へのgcc追加メモを追記しています。
sudo python ./installer_linux.py -t <Token> --no-prompt The installation of the CloudEndure Agent has started. Running the Agent Installer for a 32 bit system... Connecting to CloudEndure Console... Finished. Identifying disks for replication. Disk to replicate identified: /dev/sda of size 20.0 GiB All disks for replication were successfully identified. Downloading CloudEndure Agent... Finished. Installing CloudEndure Agent... Finished. Adding the Source machine to CloudEndure Console... Finished. Instance ID: <インスタンスID>. Installation finished successfully.
上記ログを確認後、EC2に以下のインスタンスが起動していることを確認
インスタンス: i-xxxxxxxxxxxxxxxxxxx (CloudEndure Replication Server conxx)
5)レプリケーションの設定(3)テスト
CloudEndureの管理画面-Machinesで、登録されているマシンの同期が完了するとテストが可能になります(旗が黄色になっています)。
[BLUEPRINT]でインスタンスの構成を定義できます。
MachineType:t3.micro→上記制限のため利用できない(ちゃんとエラーになる)のでt2.microで確定 Launch type:On demand Subnet:任意 Security Group:任意 Private IP:Create New EIP:None PublicIP :Yes
あとはデフォルトで[SAVE BLUEPRINT]
設定したら、テストモードで仮想マシンを移行先で起動します。
[Launchi target machine]-testmode
→この時、AWS上ではコンバーターインスタンスが起動して死んでいく
■Job Progressで進捗確認
Launch Test | Completed Successfully 2020/5/4 17:55:30 Job started 2020/5/4 17:55:30 Started waiting for latest snapshot 2020/5/4 17:56:12 Finished waiting for latest snapshot 2020/5/4 17:56:15 Started cleanup of volume Volume:vol-hogehoge 2020/5/4 17:56:16 Finished cleanup of volume Volume:vol-hogehoge 2020/5/4 17:56:19 Started machine conversions 2020/5/4 17:57:43 Finished machine conversions 2020/5/4 17:58:54 Started creating a replica for instance localhost.localdomain 2020/5/4 18:00:25 Finished creating a replica for instance localhost.localdomain 2020/5/4 18:00:26 Job finished
7)後始末
コンソールからターゲットマシンを削除します。
プロジェクト内にターゲットマシンが無くなると、Replication Serverは自動で削除されます。
以上!
■(オマケ)CentOS5にgccを追加したメモ
2. リポジトリファイルの更新
vi /etc/yum.repos.d/CentOS-Base.repo
baseurlを以下に変更
[base] baseurl=http://archive.kernel.org/centos-vault/5.9/os/$basearch [updates] baseurl=http://archive.kernel.org/centos-vault/5.9/updates/$basearch/ [extras] baseurl=http://archive.kernel.org/centos-vault/5.9/extras/$basearch/ [centosplus] baseurl=http://archive.kernel.org/centos-vault/5.9/centosplus/$basearch/ [contrib] baseurl=http://archive.kernel.org/centos-vault/5.9/contrib/$basearch/
※ここではバージョンを 5.9 としていますが、手順1で確認した CentOS のバージョンを指定してください。
yum install gcc c++