IBM Cloud: VPC의 지역 스냅샷 기능을 사용해 보았습니다.
1. 소개
VPC의 Regional Snapshot 기능인 Beta가 시작되었으므로 시도해 보았습니다. 있습니다)
h tps : // c ぉ d. 이 bm. 이 m/도 cs/vpc? 토피 c = vpc-s p pts-vpc-c Rete & ぉ 카페 =
덧붙여 여기에 기재가 있는 바와 같이, 베타라도 도쿄 리전에서는 아직 UI를 이용할 수 없는 것 같다. UI에서의 작업은 간단하게 구성할 수 있으므로, UI는 화면 캡쳐를 메인에 소개해, CLI에서의 스텝을 상세하게 쫓아 보았다.
In the UI, you can create a snapshot of a Block Storage for VPC volume that's attached to a running virtual server instance.
The snapshots UI is available only in these regions: Sydney (au-syd), France (eu-fr2), and Japan (jp-osa).
이하에 주요 특징을 적는다.
VSI를 중지하는 동안 스냅샷을 얻으려고 할 때의 오류
$ ibmcloud is snapshot-create --name syasuda-tok1-vpc1-boot-snap3 --volume r022-47b737a7-5fdb-47da-9b1e-09726a0966cc --resource-group-name Common
Creating snapshot syasuda-tok1-vpc1-boot-snap3 in resource group Common under account IBM as user [email protected]...
FAILED
Failed to create snapshot.
FAILED
Response HTTP Status Code: 409
Error code: snapshots_attached_instance_not_running
Error message: The attached instance is not running
More information: Ensure the attached instance is powered on
Trace ID: 4db45f17-eafe-42f7-b907-c5cfa47a8e9b
2. UI(오사카 리전)에서의 사용 예
2-1. Snapshot 만들기
2-2. 복원 예 1: Snapshot에서 새 VSI를 생성하는 경우
옵션으로 Snapshot
라는 카테고리가 표시됩니다.
2-3. 복원 예 2: Snapshot에서 만든 Volume을 기존 VSI에 추가하는 경우
가동중의 VSI에 Attach하는 것이 가능.
3. CLI(도쿄 리전)에서의 사용 예
CLI에 대한 가이드는 (약간 이해하기 어렵지만) 다음 탭을 선택해야합니다.
3-1. 사전 준비
사전 준비#英語表示
$ export LANG=C
#CLIの最新化
$ ibmcloud update
Checking for updates...
No update required. Your CLI is already up-to-date.
#ログイン
$ibmcloud login
or
$ibmcloud login -sso
#東京リージョンにスイッチ
$ ibmcloud target -r jp-tok
#VPC Gen2がCLIのtargetになっていることを確認
$ ibmcloud is target
Target Generation: 2
이대로도 snapshot의 CLI는 사용할 수 있지만 명령 목록에는 보이지 않는다. 커맨드리스트에의 표시를 유효화하기 위해서는 이하의 환경 변수를 설정한다.
(선택 사항) 명령 목록에 표시 사용$ ibmcloud is --help|grep snapshot
#ヘルプの有効化
$ export IBMCLOUD_IS_FEATURE_SNAPSHOT=true
$ibmcloud is --help|grep snapshot
snapshot [Beta] View details of a snapshot
snapshot-create, snapshotc [Beta] Create a snapshot from a volume
snapshot-delete, snapshotd [Beta] Delete snapshots
snapshot-delete-from-source, snapshotsd, snapshots-delete [Beta] Delete snapshots by source volume
snapshot-update, snapshotu [Beta] Update a snapshot
snapshots [Beta] List all snapshots
3-2. Snapshot 만들기
Volume 확인$ ibmcloud is volumes
Listing volumes for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Capacity IOPS Profile Attachment type Zone Resource group
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot available 100 3000 general-purpose boot jp-tok-1 Common
r022-08541c07-c825-4918-9ae1-3b94cd7e7d6e syasuda-webserver1-boot-1611015072000 available 100 3000 general-purpose boot jp-tok-1 Common
Snapshot 만들기#resource groupに何も指定をしないとDefaultで作られてしまうので、今回は指定をした。
$ ibmcloud is snapshot-create --name syasuda-tok1-vpc1-boot-snap --volume r022-47b737a7-5fdb-47da-9b1e-09726a0966cc --resource-group-name Common
Creating snapshot syasuda-tok1-vpc1-boot-snap in resource group Common under account xxx as user [email protected]...
ID r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Name syasuda-tok1-vpc1-boot-snap
CRN crn:v1:bluemix:public:is:jp-tok:a/039dbe6794084c7cb514a276dd2345da::snapshot:r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Status pending
Source Volume ID Name
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot
Progress 0
Bootable true
Deletable false
Encryption provider_managed
Encryption key -
Minimum Capacity 100
Size 1
Source Image ID Name
r022-6f153a5d-6a9a-496d-8063-5c39932f6ded ibm-centos-7-6-minimal-amd64-2
Operating System Name Vendor Version Family Architecture Display Name
centos-7-amd64 CentOS 7.x - Minimal Install CentOS amd64 CentOS 7.x - Minimal Install (amd64)
Resource group ID Name
89e3e245955e4c59a83bc9d0db590082 Common
Created 2021-03-30T09:06:45+09:00
#Snapshot取得直後のステータスはpending
$ ibmcloud is snapshots
Listing snapshots for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Progress Source Volume Bootable Resource group Created
r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 syasuda-tok1-vpc1-boot-snap pending 0 r022-47b737a7-5fdb-47da-9b1e-09726a0966cc true Common 2021-03-30T09:06:45+09:00
#Snapshot取得30秒後ぐらいのステータスはstable
$ ibmcloud is snapshots
Listing snapshots for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Progress Source Volume Bootable Resource group Created
r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 syasuda-tok1-vpc1-boot-snap stable - r022-47b737a7-5fdb-47da-9b1e-09726a0966cc true Common 2021-03-30T09:06:45+09:00
#詳細情報
$ ibmcloud is snapshot r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Getting snapshot r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 under account xxx as user [email protected]...
ID r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Name syasuda-tok1-vpc1-boot-snap
CRN crn:v1:bluemix:public:is:jp-tok:a/039dbe6794084c7cb514a276dd2345da::snapshot:r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Status stable
Source Volume ID Name
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot
Progress -
Bootable true
Deletable true
Encryption provider_managed
Encryption key -
Minimum Capacity 100
Size 2
Source Image ID Name
r022-6f153a5d-6a9a-496d-8063-5c39932f6ded ibm-centos-7-6-minimal-amd64-2
Operating System Name Vendor Version Family Architecture Display Name
centos-7-amd64 CentOS 7.x - Minimal Install CentOS amd64 CentOS 7.x - Minimal Install (amd64)
Resource group ID Name
89e3e245955e4c59a83bc9d0db590082 Common
Created 2021-03-30T09:06:45+09:00
3-3. Snapshot 복원
CLI에서도 실행할 수 있을 것 같지만, 보다 세세한 커스터마이즈를 간단하게 실시하고 싶기 때문에,
htps : // m / st 2 / / ms / 337bc02892024fb684 a3
에서 소개한 것처럼, sample API를 생성시킨 후, volume의 개소에 source_snapshot
의 항을 추가. 또, image는 지정할 필요가 없기 때문에 삭제.
추가 예 "volume":{
(省略)
"source_snapshot":{
"id":"r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6"
}
}
삭제 내용 "image": {
"id": "r022-2c5a6b07-1e34-420c-8361-286c8ba178dc"
}
createVSIfromSnapshot.sh# 実際の生成したスクリプトを、今回取得したsnapshotに合わせて置き換えた例
# Create a virtual server instance
curl -X POST \
"https://jp-tok.iaas.cloud.ibm.com/v1/instances?version=2021-03-09&generation=2" \
-H "Authorization: Bearer $iam_token" \
-H "User-Agent: IBM_One_Cloud_IS_UI/5.35.0" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "accept: application/json" \
-H "x-proxy-from: https://cloud.ibm.com/vpc-ext/data/graphql?bss_account=039dbe6794084c7cb514a276dd2345da&ims_account=1756623&country=JPN" \
-d '{
"zone": {
"name": "jp-tok-3"
},
"resource_group": {
"id": "89e3e245955e4c59a83bc9d0db590082"
},
"name": "snapshottest1",
"vpc": {
"id": "r022-85621b2c-a349-4ae6-87e3-767ddeac7298"
},
"user_data": "",
"profile": {
"name": "bx2-2x8"
},
"keys": [
{
"id": "r022-b2ea5471-72f1-454a-9d3c-c865ad02545d"
}
],
"primary_network_interface": {
"name": "eth0",
"allow_ip_spoofing": false,
"subnet": {
"id": "02g7-a65939b2-6b69-443a-b149-d7f241d7a6c1"
},
"security_groups": [
{
"id": "r022-1a2bb9f2-7647-4332-8a1b-eb925fb6e160"
}
]
},
"network_interfaces": [],
"volume_attachments": [],
"boot_volume_attachment": {
"volume": {
"name": "snapshottest1-boot-1617064484000",
"capacity": 100,
"profile": {
"name": "general-purpose"
},
"source_snapshot":{
"id":"r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6"
}
},
"delete_volume_on_instance_delete": true
}
}'
프로비저닝$ export iam_token=`ibmcloud iam oauth-tokens | awk '{printf $4}'`
$ sh createVSIfromSnapshot.sh
이제이 스냅 샷을 기반으로 VSI가 생성됩니다.
4. UUID 비교
CLI에 대한 가이드는 (약간 이해하기 어렵지만) 다음 탭을 선택해야합니다.
3-1. 사전 준비
사전 준비
#英語表示
$ export LANG=C
#CLIの最新化
$ ibmcloud update
Checking for updates...
No update required. Your CLI is already up-to-date.
#ログイン
$ibmcloud login
or
$ibmcloud login -sso
#東京リージョンにスイッチ
$ ibmcloud target -r jp-tok
#VPC Gen2がCLIのtargetになっていることを確認
$ ibmcloud is target
Target Generation: 2
이대로도 snapshot의 CLI는 사용할 수 있지만 명령 목록에는 보이지 않는다. 커맨드리스트에의 표시를 유효화하기 위해서는 이하의 환경 변수를 설정한다.
(선택 사항) 명령 목록에 표시 사용
$ ibmcloud is --help|grep snapshot
#ヘルプの有効化
$ export IBMCLOUD_IS_FEATURE_SNAPSHOT=true
$ibmcloud is --help|grep snapshot
snapshot [Beta] View details of a snapshot
snapshot-create, snapshotc [Beta] Create a snapshot from a volume
snapshot-delete, snapshotd [Beta] Delete snapshots
snapshot-delete-from-source, snapshotsd, snapshots-delete [Beta] Delete snapshots by source volume
snapshot-update, snapshotu [Beta] Update a snapshot
snapshots [Beta] List all snapshots
3-2. Snapshot 만들기
Volume 확인
$ ibmcloud is volumes
Listing volumes for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Capacity IOPS Profile Attachment type Zone Resource group
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot available 100 3000 general-purpose boot jp-tok-1 Common
r022-08541c07-c825-4918-9ae1-3b94cd7e7d6e syasuda-webserver1-boot-1611015072000 available 100 3000 general-purpose boot jp-tok-1 Common
Snapshot 만들기
#resource groupに何も指定をしないとDefaultで作られてしまうので、今回は指定をした。
$ ibmcloud is snapshot-create --name syasuda-tok1-vpc1-boot-snap --volume r022-47b737a7-5fdb-47da-9b1e-09726a0966cc --resource-group-name Common
Creating snapshot syasuda-tok1-vpc1-boot-snap in resource group Common under account xxx as user [email protected]...
ID r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Name syasuda-tok1-vpc1-boot-snap
CRN crn:v1:bluemix:public:is:jp-tok:a/039dbe6794084c7cb514a276dd2345da::snapshot:r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Status pending
Source Volume ID Name
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot
Progress 0
Bootable true
Deletable false
Encryption provider_managed
Encryption key -
Minimum Capacity 100
Size 1
Source Image ID Name
r022-6f153a5d-6a9a-496d-8063-5c39932f6ded ibm-centos-7-6-minimal-amd64-2
Operating System Name Vendor Version Family Architecture Display Name
centos-7-amd64 CentOS 7.x - Minimal Install CentOS amd64 CentOS 7.x - Minimal Install (amd64)
Resource group ID Name
89e3e245955e4c59a83bc9d0db590082 Common
Created 2021-03-30T09:06:45+09:00
#Snapshot取得直後のステータスはpending
$ ibmcloud is snapshots
Listing snapshots for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Progress Source Volume Bootable Resource group Created
r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 syasuda-tok1-vpc1-boot-snap pending 0 r022-47b737a7-5fdb-47da-9b1e-09726a0966cc true Common 2021-03-30T09:06:45+09:00
#Snapshot取得30秒後ぐらいのステータスはstable
$ ibmcloud is snapshots
Listing snapshots for generation 2 compute in all resource groups and region jp-tok under account xxx as user [email protected]...
ID Name Status Progress Source Volume Bootable Resource group Created
r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 syasuda-tok1-vpc1-boot-snap stable - r022-47b737a7-5fdb-47da-9b1e-09726a0966cc true Common 2021-03-30T09:06:45+09:00
#詳細情報
$ ibmcloud is snapshot r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Getting snapshot r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6 under account xxx as user [email protected]...
ID r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Name syasuda-tok1-vpc1-boot-snap
CRN crn:v1:bluemix:public:is:jp-tok:a/039dbe6794084c7cb514a276dd2345da::snapshot:r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6
Status stable
Source Volume ID Name
r022-47b737a7-5fdb-47da-9b1e-09726a0966cc syasuda-tok1-vpc1-boot
Progress -
Bootable true
Deletable true
Encryption provider_managed
Encryption key -
Minimum Capacity 100
Size 2
Source Image ID Name
r022-6f153a5d-6a9a-496d-8063-5c39932f6ded ibm-centos-7-6-minimal-amd64-2
Operating System Name Vendor Version Family Architecture Display Name
centos-7-amd64 CentOS 7.x - Minimal Install CentOS amd64 CentOS 7.x - Minimal Install (amd64)
Resource group ID Name
89e3e245955e4c59a83bc9d0db590082 Common
Created 2021-03-30T09:06:45+09:00
3-3. Snapshot 복원
CLI에서도 실행할 수 있을 것 같지만, 보다 세세한 커스터마이즈를 간단하게 실시하고 싶기 때문에,
htps : // m / st 2 / / ms / 337bc02892024fb684 a3
에서 소개한 것처럼, sample API를 생성시킨 후, volume의 개소에
source_snapshot
의 항을 추가. 또, image는 지정할 필요가 없기 때문에 삭제.추가 예
"volume":{
(省略)
"source_snapshot":{
"id":"r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6"
}
}
삭제 내용
"image": {
"id": "r022-2c5a6b07-1e34-420c-8361-286c8ba178dc"
}
createVSIfromSnapshot.sh
# 実際の生成したスクリプトを、今回取得したsnapshotに合わせて置き換えた例
# Create a virtual server instance
curl -X POST \
"https://jp-tok.iaas.cloud.ibm.com/v1/instances?version=2021-03-09&generation=2" \
-H "Authorization: Bearer $iam_token" \
-H "User-Agent: IBM_One_Cloud_IS_UI/5.35.0" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "accept: application/json" \
-H "x-proxy-from: https://cloud.ibm.com/vpc-ext/data/graphql?bss_account=039dbe6794084c7cb514a276dd2345da&ims_account=1756623&country=JPN" \
-d '{
"zone": {
"name": "jp-tok-3"
},
"resource_group": {
"id": "89e3e245955e4c59a83bc9d0db590082"
},
"name": "snapshottest1",
"vpc": {
"id": "r022-85621b2c-a349-4ae6-87e3-767ddeac7298"
},
"user_data": "",
"profile": {
"name": "bx2-2x8"
},
"keys": [
{
"id": "r022-b2ea5471-72f1-454a-9d3c-c865ad02545d"
}
],
"primary_network_interface": {
"name": "eth0",
"allow_ip_spoofing": false,
"subnet": {
"id": "02g7-a65939b2-6b69-443a-b149-d7f241d7a6c1"
},
"security_groups": [
{
"id": "r022-1a2bb9f2-7647-4332-8a1b-eb925fb6e160"
}
]
},
"network_interfaces": [],
"volume_attachments": [],
"boot_volume_attachment": {
"volume": {
"name": "snapshottest1-boot-1617064484000",
"capacity": 100,
"profile": {
"name": "general-purpose"
},
"source_snapshot":{
"id":"r150-4d5a7b24-98ba-4cb9-b6fb-215cc79c69e6"
}
},
"delete_volume_on_instance_delete": true
}
}'
프로비저닝
$ export iam_token=`ibmcloud iam oauth-tokens | awk '{printf $4}'`
$ sh createVSIfromSnapshot.sh
이제이 스냅 샷을 기반으로 VSI가 생성됩니다.
4. UUID 비교
snashot 원래 VSI
[root@new-syasuda-tok1-vpc1 ~]# dmidecode -s system-uuid
1ef7e055-d4b5-46e9-ac5f-014af031a808
[root@new-syasuda-tok1-vpc1 ~]# cat /sys/devices/virtual/dmi/id/product_uuid
1EF7E055-D4B5-46E9-AC5F-014AF031A808
[root@new-syasuda-tok1-vpc1 ~]# lsblk -o +LABEL,UUID,FSTYPE,SIZE,OWNER,MODE
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT LABEL UUID FSTYPE SIZE OWNER MODE
vda 253:0 0 100G 0 disk 100G root brw-rw----
├─vda1 253:1 0 1G 0 part /boot BOOT fa4c5ff7-f540-40a1-be62-347aa246a856 ext3 1G root brw-rw----
└─vda2 253:2 0 99G 0 part / ROOT ddac8416-8037-4b93-a480-71c74b7ee6e7 ext3 99G root brw-rw----
vdb 253:16 0 368K 0 disk cidata 2021-03-30-03-31-23-00 iso9660 368K root brw-rw----
vdc 253:32 0 44K 0 disk [SWAP] SWAP-xvdb1 f824a6dd-8300-4295-83b4-11dfd06bbd71 swap 44K root brw-rw----
snashot을 복원한 VSI
[root@snapshottest1 ~]# dmidecode -s system-uuid
98961c37-2d03-426f-8b9c-d09d9c646842
[root@snapshottest1 ~]# cat /sys/devices/virtual/dmi/id/product_uuid
98961C37-2D03-426F-8B9C-D09D9C646842
[root@snapshottest1 ~]# lsblk -o +LABEL,UUID,FSTYPE,SIZE,OWNER,MODE
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT LABEL UUID FSTYPE SIZE OWNER MODE
vda 253:0 0 100G 0 disk 100G root brw-rw----
├─vda1 253:1 0 1G 0 part /boot BOOT fa4c5ff7-f540-40a1-be62-347aa246a856 ext3 1G root brw-rw----
└─vda2 253:2 0 99G 0 part / ROOT ddac8416-8037-4b93-a480-71c74b7ee6e7 ext3 99G root brw-rw----
vdb 253:16 0 368K 0 disk cidata 2021-04-01-00-57-29-00 iso9660 368K root brw-rw----
vdc 253:32 0 44K 0 disk [SWAP] SWAP-xvdb1 3c2b9f6e-cfc1-488e-b01e-93349db98cc3 swap 44K root brw-rw----
Reference
이 문제에 관하여(IBM Cloud: VPC의 지역 스냅샷 기능을 사용해 보았습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/testnin2/items/b37e120d35c0bf1b671c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)