0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCPのLive migrationを試してみる

Posted at

はじめに

GCPのCopute Engineは、ホストマシンの障害時やメンテナンス時に停止、起動といったオペレーションが不要で、LiveMigration機能によりオンラインで同一ゾーン内での別ホストにMigrationが可能です。

やってみた

オペレーション自体は簡単で、gcloud compute instances simulate-maintenance-eventコマンドの引数として、インスタンス名とインスタンスが起動しているゾーンを指定する形になります。

$ date ; gcloud compute instances simulate-maintenance-event instance-3 --zone asia-northeast1-c  --verbosity
 debug ; date
Mon Sep  9 17:26:18 +09 2019
DEBUG: Running [gcloud.compute.instances.simulate-maintenance-event] with arguments: [--verbosity: "debug", --zone: "asia-northeast1-c", INSTANCE_NAMES:1: "[u'instance-3']"]
Simulating maintenance on instance(s) [https://www.googleapis.com/compute/v1/projects/tranquil-scion-251806/zones/asia-northeast1-c/instances/instance-3]
...done.                                                                                                                                                 
INFO: Display format: "none"
DEBUG: SDK update checks are disabled.
Mon Sep  9 17:27:39 +09 2019

81秒程度で完了しました。

蛇足

失敗時は、以下のように制限されてるためエラーとなります。

$ gcloud compute instances simulate-maintenance-event instance-1 --zone us-central1-a
Simulating maintenance on instance(s) [https://www.googleapis.com/compute/v1/projects/tranquil-scion-251806/zones/us-central1-a/instances/instance-1]...failed.                      
ERROR: (gcloud.compute.instances.simulate-maintenance-event) Maintenance cannot be simulated on this instance due to temporary concurrency limitations.  Please try again in a few minutes.

マシンリソースをリザーブしてから実行すればよいかと思い
https://cloud.google.com/compute/docs/instances/reserving-zonal-resources
以下のコマンドでリザーブ作成しました。

$ gcloud beta compute reservations create my-reserve \
>     --machine-type=n1-standard-1 \
>     --min-cpu-platform "Intel Sandy Bridge" \
>     --vm-count=1 \
>     --local-ssd=size=375,interface=scsi \
>     --require-specific-reservation \
>     --zone=us-central1-a

Created [https://www.googleapis.com/compute/beta/projects/tranquil-scion-251806/zones/us-central1-a/reservations/my-reserve].

しかしながら、gcloud compute instances simulate-maintenance-eventコマンドはリザーブIDを指定するオプションがないため使えませんでした。。

ちなみにf1はリザーブできないため、リザーブすると以下のようにエラーになります。

$ gcloud beta compute reservations create my-reserve2 \
>      --machine-type=f1-micro \
>      --min-cpu-platform "Intel Sandy Bridge" \
>      --vm-count=1 \
>      --local-ssd=size=375,interface=scsi \
>      --require-specific-reservation \
>      --zone=us-central1-a
ERROR: (gcloud.beta.compute.reservations.create) Could not fetch resource:
 - Invalid value for field 'resource.specificReservation.instanceProperties.machineType': 'f1-micro'. This machine type is disallowed for reservations.

投稿内容は私個人の意見であり、所属企業・部門見解を代表するものではありません。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?