NetApp ONTAPといえばSnapMirror
こんにちは、のんピ(@non____97)です。
皆さんはNetApp ONTAPと言えば何を思い浮かべますか? 私はNetApp SnapMirror(以降、SnapMirror)です。
SnapMirrorはNetAppが提供するLANやWAN経由でデータを高速にレプリケーションする機能です。SnapMirrorを活用することでDRやデータの移行、データへアクセスの負荷分散を行うことができます。
SnapMirrorの詳細は以下NetApp公式ドキュメントや、NetApp公式チャンネルの以下動画をご覧ください。
SnapMirror ボリュームのレプリケーション : ONTAP 9
SnapMirrorはAmazon FSx for NetApp ONTAP(以降、FSx for ONTAP)でも使うことができます。
これにより、同じリージョンのボリューム間のレプリケーションはもちろん、別リージョン、オンプレミス上のボリュームとレプリケーションをすることができます。
ということで、FSx for ONTAPのボリュームをSnapMirrorでレプリケーションしてみました。
2022/11/30 追記 : AWS公式ドキュメントにもSnapMirrorを使った移行手順が記載されました。併せてご覧ください。
やってみた
検証の構成
検証は以下の構成で行います。
プライマリSVM上のボリュームから同じリージョン内のセカンダリSVM上のボリュームにレプリケーションするよう設定します。
- クラスタ
- プライマリ :
FsxId06b3d2e945d454c19
- セカンダリ :
FsxId0967312eff2f5f5e1
- プライマリ :
- SVM
- プライマリ :
snapmirror-src-svm
- セカンダリ :
snapmirror-dst-svm
- プライマリ :
SVMの作成
それでは、SVMの作成から行います。
まず、SnapMirrorのレプリケーション元であるプライマリSVMを作成します。
# プライマリSVMのパラメーターを指定
$ domain_name=fsx-dev.classmethod.jp
$ organizational_unit_distinguished_name='OU=FSxForNetAppONTAP,DC=fsx-dev,DC=classmethod,DC=jp'
$ filesystem_administrators_group=FSxAdminGroup
$ service_account_user_name=FSxServiceAccount
$ service_account_password='xxxxx'
$ dns_ip=10.0.0.138
$ svm_admin_password='yyyyy'
$ file_system_id=fs-06b3d2e945d454c19
$ svm_name=snapmirror-src-svm
$ net_bios_name=SNAPMIRROR-SRC
$ create_storage_virtual_machine_input=$(cat <<EOM
{
"ActiveDirectoryConfiguration": {
"NetBiosName": "$net_bios_name",
"SelfManagedActiveDirectoryConfiguration": {
"DomainName": "$domain_name",
"OrganizationalUnitDistinguishedName": "$organizational_unit_distinguished_name",
"FileSystemAdministratorsGroup": "$filesystem_administrators_group",
"UserName": "$service_account_user_name",
"Password": "$service_account_password",
"DnsIps": [
"$dns_ip"
]
}
},
"FileSystemId": "$file_system_id",
"Name": "$svm_name",
"SvmAdminPassword": "$svm_admin_password",
"Tags": [
{
"Key": "Name",
"Value": "$svm_name"
}
],
"RootVolumeSecurityStyle": "MIXED"
}
EOM
)
# プライマリSVMの作成
$ create_storage_virtual_machine_output=$(aws fsx create-storage-virtual-machine \
--cli-input-json "$create_storage_virtual_machine_input"
)
# プライマリSVMのIDを取得
$ snapmirror_src_svm_id=$(echo $create_storage_virtual_machine_output \
| jq -r ".StorageVirtualMachine.StorageVirtualMachineId"
)
# プライマリSVMの作成が完了したことを確認
$ aws fsx describe-storage-virtual-machines \
--storage-virtual-machine-ids "$snapmirror_src_svm_id"
{
"StorageVirtualMachines": [
{
"ActiveDirectoryConfiguration": {
"NetBiosName": "SNAPMIRROR-SRC",
"SelfManagedActiveDirectoryConfiguration": {
"DomainName": "fsx-dev.classmethod.jp",
"OrganizationalUnitDistinguishedName": "OU=FSxForNetAppONTAP,DC=fsx-dev,DC=classmethod,DC=jp",
"UserName": "FSxServiceAccount",
"DnsIps": [
"10.0.0.138"
]
}
},
"CreationTime": "2022-06-07T01:17:00.814000+00:00",
"Endpoints": {
"Iscsi": {
"DNSName": "iscsi.svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"10.0.10.38",
"10.0.11.100"
]
},
"Management": {
"DNSName": "svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"198.19.255.217"
]
},
"Nfs": {
"DNSName": "svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"198.19.255.217"
]
},
"Smb": {
"DNSName": "SNAPMIRROR-SRC.fsx-dev.classmethod.jp",
"IpAddresses": [
"198.19.255.217"
]
}
},
"FileSystemId": "fs-06b3d2e945d454c19",
"Lifecycle": "CREATED",
"Name": "snapmirror-src-svm",
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:storage-virtual-machine/fs-06b3d2e945d454c19/svm-021541d8d3a6b7294",
"StorageVirtualMachineId": "svm-021541d8d3a6b7294",
"Subtype": "DEFAULT",
"UUID": "90339aa0-e5ff-11ec-af96-a9de44738137"
}
]
}
# プライマリSVMに関連付くボリュームを確認
$ aws fsx describe-volumes \
--filters Name=storage-virtual-machine-id,Values="$snapmirror_src_svm_id"
{
"Volumes": [
{
"CreationTime": "2022-06-07T01:17:24+00:00",
"FileSystemId": "fs-06b3d2e945d454c19",
"Lifecycle": "CREATED",
"Name": "snapmirror_src_svm_root",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"JunctionPath": "/",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 1024,
"StorageEfficiencyEnabled": false,
"StorageVirtualMachineId": "svm-021541d8d3a6b7294",
"StorageVirtualMachineRoot": true,
"TieringPolicy": {
"Name": "NONE"
},
"UUID": "96645404-e5ff-11ec-af96-a9de44738137",
"OntapVolumeType": "RW"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-06b3d2e945d454c19/fsvol-00a99f60354241171",
"VolumeId": "fsvol-00a99f60354241171",
"VolumeType": "ONTAP"
}
]
}
続いて、セカンダリSVMも作成します。
# セカンダリSVMのパラメーターを指定
file_system_id=fs-0967312eff2f5f5e1
svm_name=snapmirror-dst-svm
net_bios_name=SNAPMIRROR-DST
create_storage_virtual_machine_input=$(cat <<EOM
{
"ActiveDirectoryConfiguration": {
"NetBiosName": "$net_bios_name",
"SelfManagedActiveDirectoryConfiguration": {
"DomainName": "$domain_name",
"OrganizationalUnitDistinguishedName": "$organizational_unit_distinguished_name",
"FileSystemAdministratorsGroup": "$filesystem_administrators_group",
"UserName": "$service_account_user_name",
"Password": "$service_account_password",
"DnsIps": [
"$dns_ip"
]
}
},
"FileSystemId": "$file_system_id",
"Name": "$svm_name",
"SvmAdminPassword": "$svm_admin_password",
"Tags": [
{
"Key": "Name",
"Value": "$svm_name"
}
],
"RootVolumeSecurityStyle": "MIXED"
}
EOM
)
# セカンダリSVMの作成
create_storage_virtual_machine_output=$(aws fsx create-storage-virtual-machine \
--cli-input-json "$create_storage_virtual_machine_input"
)
# セカンダリSVMのIDを取得
snapmirror_dst_svm_id=$(echo $create_storage_virtual_machine_output \
| jq -r ".StorageVirtualMachine.StorageVirtualMachineId"
)
# セカンダリSVMの作成が完了したことを確認
aws fsx describe-storage-virtual-machines \
--storage-virtual-machine-ids "$snapmirror_dst_svm_id"
{
"StorageVirtualMachines": [
{
"ActiveDirectoryConfiguration": {
"NetBiosName": "SNAPMIRROR-DST",
"SelfManagedActiveDirectoryConfiguration": {
"DomainName": "fsx-dev.classmethod.jp",
"OrganizationalUnitDistinguishedName": "OU=FSxForNetAppONTAP,DC=fsx-dev,DC=classmethod,DC=jp",
"UserName": "FSxServiceAccount",
"DnsIps": [
"10.0.0.138"
]
}
},
"CreationTime": "2022-06-07T01:17:38.009000+00:00",
"Endpoints": {
"Iscsi": {
"DNSName": "iscsi.svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"10.0.10.33",
"10.0.10.226"
]
},
"Management": {
"DNSName": "svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"10.0.10.139"
]
},
"Nfs": {
"DNSName": "svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com",
"IpAddresses": [
"10.0.10.139"
]
},
"Smb": {
"DNSName": "SNAPMIRROR-DST.fsx-dev.classmethod.jp",
"IpAddresses": [
"10.0.10.139"
]
}
},
"FileSystemId": "fs-0967312eff2f5f5e1",
"Lifecycle": "CREATED",
"Name": "snapmirror-dst-svm",
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:storage-virtual-machine/fs-0967312eff2f5f5e1/svm-03f236f055a779ee6",
"StorageVirtualMachineId": "svm-03f236f055a779ee6",
"Subtype": "DEFAULT",
"UUID": "a8b5b982-e5ff-11ec-9b85-43462316743d"
}
]
}
# セカンダリSVMに関連付くボリュームを確認
aws fsx describe-volumes \
--filters Name=storage-virtual-machine-id,Values="$snapmirror_dst_svm_id"
{
"Volumes": [
{
"CreationTime": "2022-06-07T01:18:05+00:00",
"FileSystemId": "fs-0967312eff2f5f5e1",
"Lifecycle": "CREATED",
"Name": "snapmirror_dst_svm_root",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"JunctionPath": "/",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 1024,
"StorageEfficiencyEnabled": false,
"StorageVirtualMachineId": "svm-03f236f055a779ee6",
"StorageVirtualMachineRoot": true,
"TieringPolicy": {
"Name": "NONE"
},
"UUID": "aed8abd0-e5ff-11ec-b9d7-f912745d6a72",
"OntapVolumeType": "RW"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-0967312eff2f5f5e1/fsvol-059bede26353c8a11",
"VolumeId": "fsvol-059bede26353c8a11",
"VolumeType": "ONTAP"
}
]
}
SnapMirrorののレプリケーション元ボリュームの作成
次にSnapMirrorのレプリケーション元のボリュームを作成します。
# SnapMirrorのレプリケーション元ボリュームのパラメーターを指定
svm_id=$snapmirror_src_svm_id
volume_name=snapmirror_src_volume
junction_path='/snapmirror'
volume_size=1024
create_volume_input=$(cat <<EOM
{
"VolumeType": "ONTAP",
"Name": "$volume_name",
"OntapConfiguration": {
"JunctionPath": "$junction_path",
"SecurityStyle": "MIXED",
"SizeInMegabytes": $volume_size,
"StorageEfficiencyEnabled": true,
"StorageVirtualMachineId": "$svm_id",
"TieringPolicy": {
"CoolingPeriod": 31,
"Name": "AUTO"
}
},
"Tags": [
{
"Key": "Name",
"Value": "$volume_name"
}
]
}
EOM
)
# SnapMirrorのレプリケーション元ボリュームの作成
create_volume_output=$(aws fsx create-volume \
--cli-input-json "$create_volume_input"
)
# SnapMirrorのレプリケーション元ボリュームがプライマリSVMに追加されたことを確認
aws fsx describe-volumes \
--filters Name=storage-virtual-machine-id,Values="$snapmirror_src_svm_id"
{
"Volumes": [
{
"CreationTime": "2022-06-07T01:17:24+00:00",
"FileSystemId": "fs-06b3d2e945d454c19",
"Lifecycle": "CREATED",
"Name": "snapmirror_src_svm_root",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"JunctionPath": "/",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 1024,
"StorageEfficiencyEnabled": false,
"StorageVirtualMachineId": "svm-021541d8d3a6b7294",
"StorageVirtualMachineRoot": true,
"TieringPolicy": {
"Name": "NONE"
},
"UUID": "96645404-e5ff-11ec-af96-a9de44738137",
"OntapVolumeType": "RW"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-06b3d2e945d454c19/fsvol-00a99f60354241171",
"VolumeId": "fsvol-00a99f60354241171",
"VolumeType": "ONTAP"
},
{
"CreationTime": "2022-06-07T01:22:54.705000+00:00",
"FileSystemId": "fs-06b3d2e945d454c19",
"Lifecycle": "CREATED",
"Name": "snapmirror_src_volume",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"JunctionPath": "/snapmirror",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 1024,
"StorageEfficiencyEnabled": true,
"StorageVirtualMachineId": "svm-021541d8d3a6b7294",
"StorageVirtualMachineRoot": false,
"TieringPolicy": {
"CoolingPeriod": 31,
"Name": "AUTO"
},
"UUID": "5e1e297a-e600-11ec-af96-a9de44738137",
"OntapVolumeType": "RW"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-06b3d2e945d454c19/fsvol-024271888060843ef",
"VolumeId": "fsvol-024271888060843ef",
"VolumeType": "ONTAP"
}
]
}
クラスタピアリングの設定
次にクラスタピアリングの設定を行います。
SnapMirrorを使用してボリューム間でデータをレプリケーションする際は、レプリケーション元とレプリケーション先のクラスタ間、およびレプリケーション元とレプリケーション先のSVM間でピアリングする必要があります。
まず、クラスタピアリングから行います。
クラスタピアリングを行うにあたって、各クラスタのクラスター間エンドポイントを確認します。AWSマネージメントコンソールやAWS CLIのdescribe-file-systemsから確認することもできますが、NetApp ONTAP CLIから確認したい気分だったので、NetApp ONTAP CLIから確認します。
プライマリクラスタのクラスター間エンドポイントを確認
> ssh fsxadmin@management.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com
Password:
Last login time: 6/6/2022 06:47:30
FsxId06b3d2e945d454c19::> network interface show -service-policy default-intercluster
Logical Status Network Current Current Is
Vserver Interface Admin/Oper Address/Mask Node Port Home
----------- ---------- ---------- ------------------ ------------- ------- ----
FsxId06b3d2e945d454c19
inter_1 up/up 10.0.10.73/24 FsxId06b3d2e945d454c19-01
e0e true
inter_2 up/up 10.0.11.152/24 FsxId06b3d2e945d454c19-02
e0e true
2 entries were displayed.
セカンダリクラスタのクラスター間エンドポイントを確認
> ssh fsxadmin@management.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com
Password:
Last login time: 6/6/2022 05:10:38
FsxId0967312eff2f5f5e1::> network interface show -service-policy default-intercluster
Logical Status Network Current Current Is
Vserver Interface Admin/Oper Address/Mask Node Port Home
----------- ---------- ---------- ------------------ ------------- ------- ----
FsxId0967312eff2f5f5e1
inter_1 up/up 10.0.10.81/24 FsxId0967312eff2f5f5e1-01
e0e true
inter_2 up/up 10.0.10.63/24 FsxId0967312eff2f5f5e1-02
e0e true
2 entries were displayed.
各クラスタのクラスター間エンドポイント確認を確認できたので、クラスタピアリングを行います。
セカンダリクラスタからプライマリクラスタへクラスタピアリングを行います。
# セカンダリクラスタの名前を確認
FsxId0967312eff2f5f5e1::> cluster identity show
Cluster UUID: 5733f342-d70b-11ec-aeb4-877d41bba405
Cluster Name: FsxId0967312eff2f5f5e1
Cluster Serial Number: 1-80-000011
Cluster Location:
Cluster Contact:
# クラスタピアリングがないことを確認
FsxId0967312eff2f5f5e1::> cluster peer show
This table is currently empty.
# クラスタピアリングの作成
FsxId0967312eff2f5f5e1::> cluster peer create -peer-addrs 10.0.10.73, 10.0.11.152
Notice: Use a generated passphrase or choose a passphrase of 8 or more characters. To ensure the authenticity of the peering relationship, use a phrase or sequence of characters that would be hard to guess.
Enter the passphrase:
Confirm the passphrase:
Notice: Now use the same passphrase in the "cluster peer create" command in the other cluster.
# クラスタピアリングが作成されたことを確認
FsxId0967312eff2f5f5e1::> cluster peer show
Peer Cluster Name Cluster Serial Number Availability Authentication
------------------------- --------------------- -------------- --------------
FsxId06b3d2e945d454c19 - Unavailable pending
セカンダリクラスタからプライマリクラスタへのクラスタピアリングを作成したら、プライマリクラスタ側で承認します。VPCピアリングと同じような流れですね。
# プライマリクラスタの名前を確認
FsxId06b3d2e945d454c19::> cluster identity show
Cluster UUID: 5cde1111-d4de-11ec-af96-a9de44738137
Cluster Name: FsxId06b3d2e945d454c19
Cluster Serial Number: 1-80-000011
Cluster Location:
Cluster Contact:
# プライマリクラスタからはクラスタピアがまだ作成されていないことを確認
FsxId06b3d2e945d454c19::> cluster peer show
This table is currently empty.
# クラスタピアリングの受け入れ
FsxId06b3d2e945d454c19::> cluster peer create -peer-addrs 10.0.10.81, 10.0.10.63
Notice: Use a generated passphrase or choose a passphrase of 8 or more characters. To ensure the authenticity of the peering relationship, use a phrase or sequence of characters that would be hard to guess.
Enter the passphrase:
Confirm the passphrase:
# クラスタピアリングが "Available" になったことを確認
FsxId06b3d2e945d454c19::> cluster peer show
Peer Cluster Name Cluster Serial Number Availability Authentication
------------------------- --------------------- -------------- --------------
FsxId0967312eff2f5f5e1 1-80-000011 Available ok
# クラスタピアリングの詳細確認
FsxId06b3d2e945d454c19::> cluster peer show -instance
Peer Cluster Name: FsxId0967312eff2f5f5e1
Remote Intercluster Addresses: 10.0.10.81, 10.0.10.63
Availability of the Remote Cluster: Available
Remote Cluster Name: FsxId0967312eff2f5f5e1
Active IP Addresses: 10.0.10.81, 10.0.10.63
Cluster Serial Number: 1-80-000011
Remote Cluster Nodes: FsxId0967312eff2f5f5e1-01,
FsxId0967312eff2f5f5e1-02
Remote Cluster Health: true
Unreachable Local Nodes: -
Address Family of Relationship: ipv4
Authentication Status Administrative: use-authentication
Authentication Status Operational: ok
Last Update Time: 6/6/2022 09:49:22
IPspace for the Relationship: Default
Proposed Setting for Encryption of Inter-Cluster Communication: -
Encryption Protocol For Inter-Cluster Communication: tls-psk
Algorithm By Which the PSK Was Derived: jpake
クラスタピアリングを確立できたら、セカンダリクラスタからもクラスタピアリングの詳細を確認します。
FsxId0967312eff2f5f5e1::> cluster peer show -instance
Peer Cluster Name: FsxId06b3d2e945d454c19
Remote Intercluster Addresses: 10.0.10.73, 10.0.11.152
Availability of the Remote Cluster: Available
Remote Cluster Name: FsxId06b3d2e945d454c19
Active IP Addresses: 10.0.11.152, 10.0.10.73
Cluster Serial Number: 1-80-000011
Remote Cluster Nodes: FsxId06b3d2e945d454c19-01,
FsxId06b3d2e945d454c19-02
Remote Cluster Health: true
Unreachable Local Nodes: -
Address Family of Relationship: ipv4
Authentication Status Administrative: use-authentication
Authentication Status Operational: ok
Last Update Time: 6/7/2022 07:30:14
IPspace for the Relationship: Default
Proposed Setting for Encryption of Inter-Cluster Communication: -
Encryption Protocol For Inter-Cluster Communication: tls-psk
Algorithm By Which the PSK Was Derived: jpake
SVMピアリングの設定
クラスタピアリングができたので、次にSVMピアリングを行います。
プライマリSVMからSVMピアリングを行います。
# SVMピアリングがないことを確認
FsxId06b3d2e945d454c19::> vserver peer show-all
There are no Vserver peer relationships.
# プライマリSVMの情報を表示
FsxId06b3d2e945d454c19::> vserver show snapmirror-src-svm
Vserver: snapmirror-src-svm
Vserver Type: data
Vserver Subtype: default
Vserver UUID: 90339aa0-e5ff-11ec-af96-a9de44738137
Root Volume: snapmirror_src_svm_root
Aggregate: aggr1
NIS Domain: -
Root Volume Security Style: mixed
LDAP Client: -
Default Volume Language Code: C.UTF-8
Snapshot Policy: default
Data Services: data-cifs, data-iscsi, data-nfs,
data-nvme-tcp
Comment:
Quota Policy: default
List of Aggregates Assigned: aggr1
Limit on Maximum Number of Volumes allowed: unlimited
Vserver Admin State: running
Vserver Operational State: running
Vserver Operational State Stopped Reason: -
Allowed Protocols: nfs, cifs, fcp, iscsi, ndmp
Disallowed Protocols: -
Is Vserver with Infinite Volume: false
QoS Policy Group: -
Caching Policy Name: -
Config Lock: false
IPspace Name: Default
Foreground Process: -
Logical Space Reporting: false
Logical Space Enforcement: false
Default Anti_ransomware State of the Vserver's Volumes: disabled
# SVMピアリングの作成
FsxId06b3d2e945d454c19::> vserver peer create -vserver snapmirror-src-svm -peer-vserver snapmirror-dst-svm -applications snapmirror -peer-cluster FsxId0967312eff2f5f5e1
Info: [Job 427] 'vserver peer create' job queued
# SVMピアリングが作成されたことを確認
FsxId06b3d2e945d454c19::> vserver peer show-all
Peer Peer Peering Remote
Vserver Vserver State Peer Cluster Applications Vserver
----------- ----------- ------------ ----------------- -------------- ---------
snapmirror-src-svm
snapmirror-dst-svm
initiated FsxId0967312eff2f5f5e1
snapmirror snapmirror-dst-svm
SVMピアリングの作成したら、クラスタピアリングと同様にもう片方のSVM側でピアリングを承認します。
# セカンダリSVMの情報を表示
FsxId0967312eff2f5f5e1::> vserver show -vserver snapmirror-dst-svm
Vserver: snapmirror-dst-svm
Vserver Type: data
Vserver Subtype: default
Vserver UUID: a8b5b982-e5ff-11ec-9b85-43462316743d
Root Volume: snapmirror_dst_svm_root
Aggregate: aggr1
NIS Domain: -
Root Volume Security Style: mixed
LDAP Client: -
Default Volume Language Code: C.UTF-8
Snapshot Policy: default
Data Services: data-cifs, data-iscsi, data-nfs,
data-nvme-tcp
Comment:
Quota Policy: default
List of Aggregates Assigned: aggr1
Limit on Maximum Number of Volumes allowed: unlimited
Vserver Admin State: running
Vserver Operational State: running
Vserver Operational State Stopped Reason: -
Allowed Protocols: nfs, cifs, fcp, iscsi, ndmp
Disallowed Protocols: -
Is Vserver with Infinite Volume: false
QoS Policy Group: -
Caching Policy Name: -
Config Lock: false
IPspace Name: Default
Foreground Process: -
Logical Space Reporting: false
Logical Space Enforcement: false
Default Anti_ransomware State of the Vserver's Volumes: disabled
# SVMピアリングのステータスが "pending" になっていることを確認
FsxId0967312eff2f5f5e1::> vserver peer show-all -vserver snapmirror-dst-svm -peer-vserver snapmirror-src-svm -instance
Local Vserver Name: snapmirror-dst-svm
Peer Vserver Name: snapmirror-src-svm
Peering State: pending
Peering Applications: snapmirror
Peer Cluster Name: FsxId06b3d2e945d454c19
Remote Vserver Name: snapmirror-src-svm
# SVMピアリングの承認
FsxId0967312eff2f5f5e1::> vserver peer accept -vserver snapmirror-dst-svm -peer-vserver snapmirror-src-svm
Info: [Job 338] 'vserver peer accept' job queued
# SVMピアリングのステータスが "peered" になっていることを確認
FsxId0967312eff2f5f5e1::> vserver peer show-all -vserver snapmirror-dst-svm -peer-vserver snapmirror-src-svm -instance
Local Vserver Name: snapmirror-dst-svm
Peer Vserver Name: snapmirror-src-svm
Peering State: peered
Peering Applications: snapmirror
Peer Cluster Name: FsxId06b3d2e945d454c19
Remote Vserver Name: snapmirror-src-svm
SnapMirrorの設定
それでは本題のSnapMirrorの設定を行います。
SnapMirrorの設定を行うにあたって、本来であれば以下の手順を踏む必要があります。
- レプリケーション先のボリュームの作成 : volume create
- SnapMirror relationshipの作成 : snapmirror create
- SnapMirrorのベースライン転送の開始 : snapmirror initialize
一つ一つ丁寧にやっても良いですが、snapmirror protectコマンドを使うことで上述の作業を一気に行うことができます。
ちなみに、この作業はレプリケーション先となるセカンダリSVMから行う必要があります。
#セカンダリSVMにroot以外のボリュームがないことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm
Vserver Volume Aggregate State Type Size Available Used%
--------- ------------ ------------ ---------- ---- ---------- ---------- -----
snapmirror-dst-svm
snapmirror_dst_svm_root
aggr1 online RW 1GB 972.5MB 0%
# SnapMirror relationshipがないことを確認
FsxId0967312eff2f5f5e1::> snapmirror show
This table is currently empty.
# レプリケーション先ボリュームの作成
# SnapMirror relationshipの作成
# SnapMirrorのベースライン転送の開始
# レプリケーションリングは5分間隔
FsxId0967312eff2f5f5e1::> snapmirror protect -path-list snapmirror-src-svm:snapmirror_src_volume -destination-vserver snapmirror-dst-svm -policy MirrorAllSnapshots -schedule 5min -auto-initialize true -support-tiering true -tiering-policy auto
[Job 339] Job is queued: snapmirror protect for list of source endpoints beginning with "snapmirror-src-svm:snapmirror_src_volume".
# SnapMirror relationshipが作成されたことを確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Snapmirrored
Idle - true -
# SnapMirror relationshipの詳細を確認
FsxId0967312eff2f5f5e1::> snapmirror show -instance
Source Path: snapmirror-src-svm:snapmirror_src_volume
Destination Path: snapmirror-dst-svm:snapmirror_src_volume_dst
Relationship Type: XDP
Relationship Group Type: none
SnapMirror Schedule: 5min
SnapMirror Policy Type: async-mirror
SnapMirror Policy: MirrorAllSnapshots
Tries Limit: -
Throttle (KB/sec): unlimited
Mirror State: Snapmirrored
Relationship Status: Idle
File Restore File Count: -
File Restore File List: -
Transfer Snapshot: -
Snapshot Progress: -
Total Progress: -
Percent Complete for Current Status: -
Network Compression Ratio: -
Snapshot Checkpoint: -
Newest Snapshot: snapmirror.a8b5b982-e5ff-11ec-9b85-43462316743d_2161319955.2022-06-07_015130
Newest Snapshot Timestamp: 06/07 01:51:30
Exported Snapshot: snapmirror.a8b5b982-e5ff-11ec-9b85-43462316743d_2161319955.2022-06-07_015130
Exported Snapshot Timestamp: 06/07 01:51:30
Healthy: true
Unhealthy Reason: -
Destination Volume Node: FsxId0967312eff2f5f5e1-01
Relationship ID: 59eadf92-e604-11ec-9b85-43462316743d
Current Operation ID: -
Transfer Type: -
Transfer Error: -
Current Throttle: -
Current Transfer Priority: -
Last Transfer Type: update
Last Transfer Error: -
Last Transfer Size: 0B
Last Transfer Network Compression Ratio: 1:1
Last Transfer Duration: 0:0:0
Last Transfer From: snapmirror-src-svm:snapmirror_src_volume
Last Transfer End Timestamp: 06/07 01:51:32
Progress Last Updated: -
Relationship Capability: 8.2 and above
Lag Time: 0:2:20
Identity Preserve Vserver DR: -
Volume MSIDs Preserved: -
Is Auto Expand Enabled: -
Number of Successful Updates: 1
Number of Failed Updates: 0
Number of Successful Resyncs: 0
Number of Failed Resyncs: 0
Number of Successful Breaks: 0
Number of Failed Breaks: 0
Total Transfer Bytes: 17624
Total Transfer Time in Seconds: 2
FabricLink Source Role: -
FabricLink Source Bucket: -
FabricLink Peer Role: -
FabricLink Peer Bucket: -
FabricLink Topology: -
FabricLink Pull Byte Count: -
FabricLink Push Byte Count: -
FabricLink Pending Work Count: -
FabricLink Status: -
# レプリケーション先ボリュームが作成されたことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm
Vserver Volume Aggregate State Type Size Available Used%
--------- ------------ ------------ ---------- ---- ---------- ---------- -----
snapmirror-dst-svm
snapmirror_dst_svm_root
aggr1 online RW 1GB 972.5MB 0%
snapmirror-dst-svm
snapmirror_src_volume_dst
aggr1 online DP 128.0MB 121.3MB 0%
2 entries were displayed.
25分ほど待つと、AWS側でもレプリケーション先ボリュームが作成されたことを確認できました。
$ snapmirror_dst_svm_id=svm-03f236f055a779ee6
$ aws fsx describe-volumes \
--filters Name=storage-virtual-machine-id,Values="$snapmirror_dst_svm_id"
{
"Volumes": [
{
"CreationTime": "2022-06-07T01:18:05+00:00",
"FileSystemId": "fs-0967312eff2f5f5e1",
"Lifecycle": "CREATED",
"Name": "snapmirror_dst_svm_root",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"JunctionPath": "/",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 1024,
"StorageEfficiencyEnabled": false,
"StorageVirtualMachineId": "svm-03f236f055a779ee6",
"StorageVirtualMachineRoot": true,
"TieringPolicy": {
"Name": "NONE"
},
"UUID": "aed8abd0-e5ff-11ec-b9d7-f912745d6a72",
"OntapVolumeType": "RW"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-0967312eff2f5f5e1/fsvol-059bede26353c8a11",
"VolumeId": "fsvol-059bede26353c8a11",
"VolumeType": "ONTAP"
},
{
"CreationTime": "2022-06-07T01:51:29+00:00",
"FileSystemId": "fs-0967312eff2f5f5e1",
"Lifecycle": "CREATED",
"Name": "snapmirror_src_volume_dst",
"OntapConfiguration": {
"FlexCacheEndpointType": "NONE",
"SecurityStyle": "MIXED",
"SizeInMegabytes": 127,
"StorageEfficiencyEnabled": false,
"StorageVirtualMachineId": "svm-03f236f055a779ee6",
"StorageVirtualMachineRoot": false,
"TieringPolicy": {
"CoolingPeriod": 31,
"Name": "AUTO"
},
"UUID": "595004fd-e604-11ec-9b85-43462316743d",
"OntapVolumeType": "DP"
},
"ResourceARN": "arn:aws:fsx:ap-northeast-1:<AWSアカウントID>:volume/fs-0967312eff2f5f5e1/fsvol-0d53dc63a709441de",
"VolumeId": "fsvol-0d53dc63a709441de",
"VolumeType": "ONTAP"
}
]
}
レプリケーション先ボリュームのサイズ変更
snapmirror protectでレプリケーション先ボリュームが作成できましたが、ボリュームサイズが128MBです。
# レプリケーション先ボリュームの詳細情報
FsxId0967312eff2f5f5e1::> volume show snapmirror_src_volume_dst -instance
Vserver Name: snapmirror-dst-svm
Volume Name: snapmirror_src_volume_dst
Aggregate Name: aggr1
List of Aggregates for FlexGroup Constituents: aggr1
Encryption Type: none
List of Nodes Hosting the Volume: FsxId0967312eff2f5f5e1-01
Volume Size: 128.0MB
Volume Data Set ID: 1037
Volume Master Data Set ID: 2161319955
Volume State: online
Volume Style: flex
Extended Volume Style: flexvol
FlexCache Endpoint Type: none
Is Cluster-Mode Volume: true
Is Constituent Volume: false
Number of Constituent Volumes: -
Export Policy: default
User ID: 0
Group ID: 0
Security Style: mixed
UNIX Permissions: ---rwxr-xr-x
Junction Path: -
Junction Path Source: -
Junction Active: -
Junction Parent Volume: -
Comment:
Available Size: 121.3MB
Filesystem Size: 128.0MB
Total User-Visible Size: 121.6MB
Used Size: 300KB
Used Percentage: 0%
Volume Nearly Full Threshold Percent: 95%
Volume Full Threshold Percent: 98%
Maximum Autosize: 100TB
Minimum Autosize: 22MB
Autosize Grow Threshold Percentage: 85%
Autosize Shrink Threshold Percentage: 80%
Autosize Mode: grow_shrink
Total Files (for user-visible data): 31122
Files Used (for user-visible data): 96
Space Guarantee in Effect: true
Space SLO in Effect: true
Space SLO: none
Space Guarantee Style: none
Fractional Reserve: 0%
Volume Type: DP
Snapshot Directory Access Enabled: true
Space Reserved for Snapshot Copies: 5%
Snapshot Reserve Used: 6%
Snapshot Policy: none
Creation Time: Tue Jun 07 01:51:29 2022
Language: C.UTF-8
Clone Volume: false
Node name: FsxId0967312eff2f5f5e1-01
Clone Parent Vserver Name: -
FlexClone Parent Volume: -
NVFAIL Option: off
Volume's NVFAIL State: false
Force NVFAIL on MetroCluster Switchover: off
Is File System Size Fixed: false
(DEPRECATED)-Extent Option: off
Reserved Space for Overwrites: 0B
Primary Space Management Strategy: volume_grow
Read Reallocation Option: off
Naming Scheme for Automatic Snapshot Copies: create_time
Inconsistency in the File System: false
Is Volume Quiesced (On-Disk): false
Is Volume Quiesced (In-Memory): false
Volume Contains Shared or Compressed Data: true
Space Saved by Storage Efficiency: 0B
Percentage Saved by Storage Efficiency: 0%
Space Saved by Deduplication: 0B
Percentage Saved by Deduplication: 0%
Space Shared by Deduplication: 0B
Space Saved by Compression: 0B
Percentage Space Saved by Compression: 0%
Volume Size Used by Snapshot Copies: 372KB
Block Type: 64-bit
Is Volume Moving: false
Flash Pool Caching Eligibility: read-write
Flash Pool Write Caching Ineligibility Reason: -
Constituent Volume Role: -
QoS Policy Group Name: -
QoS Adaptive Policy Group Name: -
Caching Policy Name: -
Is Volume Move in Cutover Phase: false
Number of Snapshot Copies in the Volume: 2
VBN_BAD may be present in the active filesystem: false
Is Volume on a hybrid aggregate: false
Total Physical Used Size: 672KB
Physical Used Percentage: 1%
FlexGroup Name: -
Is Volume a FlexGroup: false
SnapLock Type: non-snaplock
Vserver DR Protection: -
Enable or Disable Encryption: false
Is Volume Encrypted: false
Encryption State: none
Encryption Key ID:
Application: -
Is Fenced for Protocol Access: false
Protocol Access Fence Owner: -
Is SIDL enabled: off
Over Provisioned Size: 0B
Available Snapshot Reserve Size: 6.04MB
Logical Used Size: 300KB
Logical Used Percentage: 0%
Logical Available Size: -
Logical Size Used by Active Filesystem: 300KB
Logical Size Used by All Snapshots: 0B
Logical Space Reporting: false
Logical Space Enforcement: false
Volume Tiering Policy: auto
Performance Tier Inactive User Data: -
Performance Tier Inactive User Data Percent: -
Tags to be Associated with Objects Stored on a FabricPool: -
Does the Object Tagging Scanner Need to Run on This Volume: false
Is File System Analytics Supported: false
Reason File System Analytics is not Supported: File system analytics is not supported on SnapMirror destination volumes.
File System Analytics State: off
File System Analytics Scan Progress: -
Activity Tracking State: off
Is Activity Tracking Supported: false
Reason Activity Tracking Is Not Supported: Volume activity tracking is not supported on SnapMirror destination volumes.
Is SMBC Master: false
Is SMBC Failover Capable: false
SMBC Consensus: -
Anti-ransomware State: disabled
一方、レプリケーション先のボリュームのサイズは1GBです。レプリケーション先ボリュームは最大100TBまで自動で拡張するようになっていますが、一気に128MB以上のデータが送られてきた場合の挙動が心配なので、レプリケーション先ボリュームのサイズをレプリケーション元ボリュームのサイズに拡張してあげようと思います。
# レプリケーション先ボリュームのサイズ確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields size, max-autosize
vserver volume size max-autosize
------------------ ----------------------- ---- ------------
snapmirror-dst-svm snapmirror_dst_svm_root 1GB 1.20GB
snapmirror-dst-svm snapmirror_src_volume_dst
128.0MB
100TB
2 entries were displayed.
# レプリケーション先ボリュームのサイズを1GBに変更
FsxId0967312eff2f5f5e1::> volume modify -vserver snapmirror-dst-svm -volume snapmirror_src_volume_dst -size 1GB
Volume modify successful on volume snapmirror_src_volume_dst of Vserver snapmirror-dst-svm.
Based on the new volume size, the system automatically adjusted the volume autosize settings as follows:
The volume is set to shrink to a minimum of 1g when the volume-used space falls below 80%.
# レプリケーション先ボリュームのサイズが1GBに拡張されたことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields size, max-autosize
vserver volume size max-autosize
------------------ ----------------------- ---- ------------
snapmirror-dst-svm snapmirror_dst_svm_root 1GB 1.20GB
snapmirror-dst-svm snapmirror_src_volume_dst
1GB 100TB
2 entries were displayed.
レプリケーション先ボリュームのジャンクションパスの設定
作成されたレプリケーション先ボリュームにはジャンクションパスが設定されていません。
レプリケーション先ボリュームをマウントできるようにジャンクションパスを設定してあげます。
# レプリケーション先ボリュームにジャンクションパスが設定されていないことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields junction-path
vserver volume junction-path
------------------ ----------------------- -------------
snapmirror-dst-svm snapmirror_dst_svm_root /
snapmirror-dst-svm snapmirror_src_volume_dst
-
2 entries were displayed.
# レプリケーション先ボリュームにジャンクションパス "/snapmirror" を設定
FsxId0967312eff2f5f5e1::> volume mount -vserver snapmirror-dst-svm -volume snapmirror_src_volume_dst -junction-path /snapmirror
# レプリケーション先ボリュームにジャンクションパスが設定されたことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields junction-path
vserver volume junction-path
------------------ ----------------------- -------------
snapmirror-dst-svm snapmirror_dst_svm_root /
snapmirror-dst-svm snapmirror_src_volume_dst
/snapmirror
2 entries were displayed.
レプリケーションの確認
それではレプリケーションの確認を行います。
レプリケーション元ボリューム、レプリケーション先ボリュームどちらもAmazon Linux 2のEC2インスタンスにNFSでマウントします。
# 現在のディスクサイズを確認
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 462M 0 462M 0% /dev
tmpfs 470M 0 470M 0% /dev/shm
tmpfs 470M 452K 470M 1% /run
tmpfs 470M 0 470M 0% /sys/fs/cgroup
/dev/nvme0n1p1 8.0G 1.7G 6.4G 21% /
# マウントポイントの作成
$ sudo mkdir /snapmirror-src
$ sudo mkdir /snapmirror-dst
# マウント
$ sudo mount -t nfs svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com:/snapmirror /snapmirror-src/
$ sudo mount -t nfs svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com:/snapmirror /snapmirror-dst
# レプリケーション元ボリューム、レプリケーション先ボリュームがNFSでマウントされていることを確認
$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 462M 0 462M 0% /dev
tmpfs tmpfs 470M 0 470M 0% /dev/shm
tmpfs tmpfs 470M 456K 470M 1% /run
tmpfs tmpfs 470M 0 470M 0% /sys/fs/cgroup
/dev/nvme0n1p1 xfs 8.0G 1.7G 6.4G 21% /
/dev/mapper/3600a09806c574231752b53784865462f1 ext4 2.0G 6.1M 1.8G 1% /lun/part1
/dev/mapper/3600a09806c574231752b537848654672p2 ext4 2.9G 9.1M 2.8G 1% /lun/part2
svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com:/snapmirror nfs4 973M 384K 973M 1% /snapmirror-src
svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com:/snapmirror nfs4 973M 320K 973M 1% /snapmirror-dst
$ mount | grep nfs
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
svm-021541d8d3a6b7294.fs-06b3d2e945d454c19.fsx.ap-northeast-1.amazonaws.com:/snapmirror on /snapmirror-src type nfs4 (rw,relatime,vers=4.1,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.162,local_lock=none,addr=198.19.255.217)
svm-03f236f055a779ee6.fs-0967312eff2f5f5e1.fsx.ap-northeast-1.amazonaws.com:/snapmirror on /snapmirror-dst type nfs4 (rw,relatime,vers=4.1,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.162,local_lock=none,addr=10.0.10.139)
レプリケーションされたかを確認するために、レプリケーション元ボリュームをマウントしているディレクトリに空ファイルを作成します。
# レプリケーション元ボリュームをマウントしているディレクトリに空ファイルを作成
$ sudo touch /snapmirror-src/snapmirror_test_$(date +%Y%m%d%H%M%S).txt
$ sudo touch /snapmirror-src/snapmirror_test_$(date +%Y%m%d%H%M%S).txt
# レプリケーション元ボリュームをマウントしているディレクトリとレプリケーション先ボリュームをマウントしているディレクトリ内を確認
$ ls -l /snapmirror-*
/snapmirror-dst:
total 0
/snapmirror-src:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:36 snapmirror_test_20220607023613.txt
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
5分間隔でレプリケーションしているので11:40過ぎに確認すると、レプリケーション元ボリューム内のファイルがレプリケーション先ボリューム内にも表示されました。正しくSnapMirrorでレプリケーションされていそうですね。
# 11:39:30 に各ディレクトリを確認
# このタイミングではまだレプリケーションされていない
$ date; ls -l /snapmirror-*
Tue Jun 7 02:39:30 UTC 2022
/snapmirror-dst:
total 0
/snapmirror-src:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:36 snapmirror_test_20220607023613.txt
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
# 11:40:02 に各ディレクトリを確認
# このタイミングではまだレプリケーションされていない
$ date; ls -l /snapmirror-*
Tue Jun 7 02:40:02 UTC 2022
/snapmirror-dst:
total 0
/snapmirror-src:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:36 snapmirror_test_20220607023613.txt
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
# 11:40:22 に各ディレクトリを確認
# レプリケーションされたことを確認
$ date; ls -l /snapmirror-*
Tue Jun 7 02:40:22 UTC 2022
/snapmirror-dst:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:36 snapmirror_test_20220607023613.txt
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:36 snapmirror_test_20220607023613.txt
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
なお、レプリケーション先ボリュームをマウントしているディレクトリには書き込み権限がありません。
# レプリケーション先ボリュームをマウントしているディレクトリに変更を加えようとしても、拒否される
$ sudo rm /snapmirror-dst/snapmirror_test_20220607023613.txt
rm: cannot remove ‘/snapmirror-dst/snapmirror_test_20220607023613.txt’: Read-only file system
$ sudo chown -R ssm-user:ssm-user /snapmirror-dst/
chown: changing ownership of ‘/snapmirror-dst/snapmirror_test_20220607023613.txt’: Read-only file system
chown: changing ownership of ‘/snapmirror-dst/snapmirror_test_20220607023755.txt’: Read-only file system
chown: changing ownership of ‘/snapmirror-dst/’: Read-only file system
# レプリケーション元ボリュームをマウントしているディレクトリでは変更ができる
$ sudo rm /snapmirror-src/snapmirror_test_20220607023613.txt
$ ls -l /snapmirror-*
/snapmirror-dst:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
$ sudo chown -R ssm-user:ssm-user /snapmirror-src/
$ ls -ld /snapmirror-src
drwxr-xr-x 2 ssm-user ssm-user 4096 Jun 7 02:45 /snapmirror-src
$ ls -l /snapmirror-src/
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
これはレプリケーション先ボリュームのタイプがDP
になっているためです。
DP
はデータ保護用ボリュームを示すボリュームタイプで、DP
を指定することで読み込み専用ボリュームとなります。通常のSnapMirrorは片方向のレプリケーションです。レプリケーション先ボリュームがDP
となっていることでレプリケーション先ボリュームに変更を加えることを防ぎ、レプリケーションの不整合が起きないようにしています。
また、SnapMirrorは権限周りもレプリケーションしてくれます。
$ touch /snapmirror-src/snapmirror_test_$(date +%Y%m%d%H%M%S).txt
# 11:49:59 に各ディレクトリを確認
# このタイミングではまだレプリケーションされていない
$ date; ls -l /snapmirror-*
Tue Jun 7 02:49:59 UTC 2022
/snapmirror-dst:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
# 11:50:01 に各ディレクトリを確認
# このタイミングではまだレプリケーションされていない
$ date; ls -l /snapmirror-*
Tue Jun 7 02:50:01 UTC 2022
/snapmirror-dst:
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
# 11:50:05 に各ディレクトリを確認
# レプリケーションされたことを確認
$ date; ls -l /snapmirror-*
Tue Jun 7 02:50:05 UTC 2022
/snapmirror-dst:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
レプリケーションの停止
SnapMirrorを使ってデータ移行をする場合、最終的どこかのタイミングでレプリケーションを停止し、レプリケーション先で書き込みができるようにする必要があります。
ということでレプリケーションを停止させて、レプリケーション先ボリュームで書き込みできるようにしてあげます。
# SnapMirrorの状態確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Snapmirrored
Idle - true -
# 以降のレプリケーションを停止する
FsxId0967312eff2f5f5e1::> snapmirror quiesce -destination-path snapmirror-dst-svm:snapmirror_src_volume_dst
Operation succeeded: snapmirror quiesce for destination "snapmirror-dst-svm:snapmirror_src_volume_dst".
# SnapMirror relationshipのステータスが "Quiesced" になっていることを確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Snapmirrored
Quiesced - true -
# SnapMirror relationshipを解除し、レプリケーション先ボリュームを書き込み可能にする
FsxId0967312eff2f5f5e1::> snapmirror break -destination-path snapmirror-dst-svm:snapmirror_src_volume_dst
Operation succeeded: snapmirror break for destination "snapmirror-dst-svm:snapmirror_src_volume_dst".
# SnapMirrorのミラーステータスが "Broken-off" になっていることを確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Broken-off
Idle - true -
# レプリケーション先ボリュームのタイプが "RW" になったことを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields type
vserver volume type
------------------ ----------------------- ----
snapmirror-dst-svm snapmirror_dst_svm_root RW
snapmirror-dst-svm snapmirror_src_volume_dst
RW
2 entries were displayed.
これにより、レプリケーションされなくなります。
$ touch /snapmirror-src/snapmirror_test_$(date +%Y%m%d%H%M%S).txt
# 11:55:17 に各ディレクトリを確認
# 11:54 に作成した "snapmirror_test_20220607025454.txt" がレプリケーションされていないことを確認
$ date; ls -l /snapmirror-*
Tue Jun 7 02:55:17 UTC 2022
/snapmirror-dst:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:54 snapmirror_test_20220607025454.txt
レプリケーション先ボリュームで変更ができるようになっていることも確認します。
# ファイルの削除
$ rm /snapmirror-dst/snapmirror_test_20220607023755.txt
$ ls -l /snapmirror-dst
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
# 権限の変更
$ sudo chown root:root /snapmirror-dst/snapmirror_test_20220607024813.txt
$ ls -l /snapmirror-dst
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
# ファイルの作成
$ touch /snapmirror-dst/snapmirror_test_$(date +%Y%m%d%H%M%S).txt
$ ls -l /snapmirror-dst
total 0
-rw-r--r-- 1 root root 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 03:00 snapmirror_test_20220607030041.txt
再レプリケーション
再レプリケーションしてあげます。
レプリケーション先ボリュームで色々変更処理をしてしまったので、本来であれば一度レプリケーション方向を反転させて、データの不整合がないようにしてあげる必要があります。
今回は横着して、特に何もせずに再レプリケーションします。
# SnapMirrorの状態確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Broken-off
Idle - false -
# SnapMirrorの履歴確認
FsxId0967312eff2f5f5e1::> snapmirror show-history
Destination Source Start End
Path Path Operation Time Time Result
----------- ----------- --------- ----------- ----------- -------
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 03:05:00
6/7/2022 03:05:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 03:00:00
6/7/2022 03:00:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:55:00
6/7/2022 02:55:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
break 6/7/2022 02:54:19
6/7/2022 02:54:19
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
quiesce 6/7/2022 02:53:26
6/7/2022 02:53:26
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:50:00
6/7/2022 02:50:05
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:45:00
6/7/2022 02:45:04
success
Destination Source Start End
Path Path Operation Time Time Result
----------- ----------- --------- ----------- ----------- -------
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:40:00
6/7/2022 02:40:05
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:35:00
6/7/2022 02:35:04
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:30:00
6/7/2022 02:30:05
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:25:00
6/7/2022 02:25:04
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:20:00
6/7/2022 02:20:05
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:15:00
6/7/2022 02:15:05
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:10:00
6/7/2022 02:10:05
success
Destination Source Start End
Path Path Operation Time Time Result
----------- ----------- --------- ----------- ----------- -------
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:05:00
6/7/2022 02:05:07
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:00:00
6/7/2022 02:00:04
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 01:55:00
6/7/2022 01:55:04
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
initialize
1/1/1970 00:00:00
6/7/2022 01:51:32
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
create 6/7/2022 01:51:30
6/7/2022 01:51:30
success
19 entries were displayed.
# SnapMirror relationshipを再確立
# レプリケーション先ボリュームにあってレプリケーション元ボリュームにないデータが削除されることを確認
FsxId0967312eff2f5f5e1::> snapmirror resync -destination-path snapmirror-dst-svm:snapmirror_src_volume_dst -source-path snapmirror-src-svm:snapmirror_src_volume
Warning: All data newer than Snapshot copy snapmirror.a8b5b982-e5ff-11ec-9b85-43462316743d_2161319955.2022-06-07_025000 on volume snapmirror-dst-svm:snapmirror_src_volume_dst will be deleted.
Do you want to continue? {y|n}: y
Operation is queued: initiate snapmirror resync to destination "snapmirror-dst-svm:snapmirror_src_volume_dst".
# SnapMirrorのミラーステータスが "Snapmirrored" になっていることを確認
FsxId0967312eff2f5f5e1::> snapmirror show
Progress
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
snapmirror-src-svm:snapmirror_src_volume
XDP snapmirror-dst-svm:snapmirror_src_volume_dst
Snapmirrored
Idle - true -
# 再レプリケーションされたことを確認
FsxId0967312eff2f5f5e1::> snapmirror show-history
Destination Source Start End
Path Path Operation Time Time Result
----------- ----------- --------- ----------- ----------- -------
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
resync 6/7/2022 03:12:56
6/7/2022 03:13:00
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 03:10:00
6/7/2022 03:10:03
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 03:05:00
6/7/2022 03:05:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 03:00:00
6/7/2022 03:00:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
scheduled-update
6/7/2022 02:55:00
6/7/2022 02:55:02
failure
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
break 6/7/2022 02:54:19
6/7/2022 02:54:19
success
snapmirror-dst-svm:snapmirror_src_volume_dst
snapmirror-src-svm:snapmirror_src_volume
quiesce 6/7/2022 02:53:26
6/7/2022 02:53:26
success
Press <space> to page down, <return> for next line, or 'q' to quit... q
7 entries were displayed.
# レプリケーション先ボリュームのタイプが "DP" になっていることを確認
FsxId0967312eff2f5f5e1::> volume show -vserver snapmirror-dst-svm -fields type
vserver volume type
------------------ ----------------------- ----
snapmirror-dst-svm snapmirror_dst_svm_root RW
snapmirror-dst-svm snapmirror_src_volume_dst
DP
2 entries were displayed.
EC2インスタンスから各ディレクトリを確認すると、ディレクトリ内のファイルが一致しており、確かに再レプリケーションされたことが分かりました。
# ディレクトリ内のファイルが一致していることを確認
$ ls -l /snapmirror-*
/snapmirror-dst:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:54 snapmirror_test_20220607025454.txt
/snapmirror-src:
total 0
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:37 snapmirror_test_20220607023755.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:48 snapmirror_test_20220607024813.txt
-rw-r--r-- 1 ssm-user ssm-user 0 Jun 7 02:54 snapmirror_test_20220607025454.txt
SnapMirrorはいいぞ
FSx for ONTAPのボリュームをSnapMirrorでレプリケーションしてみました。
今までオンプレミス環境でNetApp ONTAPを使っている方はSnapMirrorを使うことでかなり移行が楽になるのではないでしょうか。
Q: オンプレミスから Amazon FSx for NetApp ONTAP にデータを移行するにはどうすればよいですか?
A: 現在 NetApp ONTAP 上に構築されたファイルストレージを使用している場合は、NetApp SnapMirror を使用して、AWS Direct Connect または VPN を介してデータと設定を Amazon FSx for NetApp ONTAP にすばやく効率的にコピーできます。NetApp 以外のファイルシステムから移行する場合は、標準のコピーツール (rsync、Robocopy など) または NetApp CloudSync を使用して、データを FSx for ONTAP に移行できます。
もちろん、移行用途だけでなくDRとしても使えるので、マルチリージョンでデータを保護したい場合は積極的に活用していきたいですね。
Q: ファイルシステム内のデータのクロスリージョンレプリケーションを設定するにはどうすればよいですか?
A: Amazon FSx for NetApp ONTAP は、2 つの ONTAP ファイルシステム間でデータをレプリケートするために使用できるレプリケーションテクノロジーである NetApp SnapMirror をサポートしています。別の AWS リージョンのファイルシステムを含む、別の Amazon FSx for NetApp ONTAP ファイルシステムへのデータの自動 NetApp SnapMirror レプリケーションを設定できます。必要に応じて、アプリケーションとユーザーをフェイルオーバーして、他の Amazon FSx for NetApp ONTAP ファイルシステムを使用できます。SnapMirror では、最短 5 分の目標復旧時点 (RPO) と 1 桁の分単位の目標復旧時間 (RTO) でレプリケーションを設定できます。SnapMirror は、ONTAP CLI または REST API を使用して設定できます。
少し古い情報(ONTAP 8.3)ですが、SnapMirrorの管理コマンドは以下にまとまっています。気になる方はご参考ください。
また、「そもそもSnapMirror何も分からん」という方は、以下動画が非常に分かりやすかったので、ご参照ください。
この記事が誰かの助けになれば幸いです。
以上、AWS事業本部 コンサルティング部の のんピ(@non____97)でした!