10.14. S3 互換プラットフォームへのポリシーベースのデータアーカイブおよび取得
オブジェクトライフサイクル移行ルールを使用すると、オブジェクトをあるストレージクラスから別の S3 互換プラットフォームに移行できます。
Ceph Object Gateway ライフサイクル移行ポリシーを使用して、データを S3 互換プラットフォームに移行できます。
マルチサイト設定では、ライフサイクル移行ルールが最初のサイトに適用され、同じストレージクラスター内のあるデータプールから別のデータプールにオブジェクトを移行する場合は、2 番目のサイトに rgw アプリケーションで作成され有効になっているそれぞれのデータプールがあれば、同じルールが 2 番目のサイトにも有効になります。
10.14.1. Amazon S3 クラウドサービスへのデータの移行 リンクのコピーリンクがクリップボードにコピーされました!
ストレージクラスを使用してライフサイクル設定の一部としてデータをリモートクラウドサービスに移行し、コストを削減して管理性を向上させることができます。移行は単方向であり、リモートゾーンからデータを戻すことはできません。Amazon (S3) など複数のクラウドプロバイダーへのデータ移行を可能にする機能です。
cloud-s3 を tier-type として使用して、データの移行先となるリモートクラウド S3 オブジェクトストアサービスを設定します。これらはデータプールを必要とせず、ゾーングループ配置ターゲットに関して定義されます。
前提条件
始める前に、次の前提条件が満たされていることを確認してください。
- Ceph Object Gateway がインストールされた Red Hat Ceph Storage クラスター。
- リモートクラウドサービス、Amazon S3 のユーザー認証情報。
- Amazon S3 で作成されたターゲットパス。
-
ブートストラップされたノードにインストールされた
s3cmd。 - データをダウンロードするようにローカルに設定された Amazon AWS。
手順
アクセスキーとシークレットキーを使用してユーザーを作成します。
構文
radosgw-admin user create --uid=USER_NAME --display-name="DISPLAY_NAME" [--access-key ACCESS_KEY --secret-key SECRET_KEY]例
[ceph: root@host01 /]# radosgw-admin user create --uid=test-user --display-name="test-user" --access-key a21e86bce636c3aa1 --secret-key cf764951f1fdde5e { "user_id": "test-user", "display_name": "test-user", "email": "", "suspended": 0, "max_buckets": 1000, "subusers": [], "keys": [ { "user": "test-user", "access_key": "a21e86bce636c3aa1", "secret_key": "cf764951f1fdde5e" } ], "swift_keys": [], "caps": [], "op_mask": "read, write, delete", "default_placement": "", "default_storage_class": "", "placement_tags": [], "bucket_quota": { "enabled": false, "check_on_raw": false, "max_size": -1, "max_size_kb": 0, "max_objects": -1 }, "user_quota": { "enabled": false, "check_on_raw": false, "max_size": -1, "max_size_kb": 0, "max_objects": -1 }, "temp_url_keys": [], "type": "rgw", "mfa_ids": [] }Red Hat Ceph Storage 8.1 以降では、層タイプオプションは
cloud-s3とcloud-s3-glacierです。cloud-s3を使用する場合は、次の手順に進みます。この手順を使用して、cloud-s3-glacier層タイプを追加します。構文
radosgw-admin zonegroup placement add --rgw-zonegroup =ZONE_GROUP_NAME \ --placement-id=PLACEMENT_ID \ --storage-class =CLOUDTIER-GLACIER \ --tier-type=cloud-s3-glacier例
[ceph: root@host01 /]# radosgw-admin zonegroup placement add --rgw-zonegroup=default \ --placement-id=default-placement \ --storage-class=CLOUDTIER-GLACIER \ --tier-type=cloud-s3-glacier [ { "key": "CLOUDTIER-GLACIER", "val": { "tier_type": "cloud-s3-glacier", "storage_class": "CLOUDTIER-GLACIER", "retain_head_object": true, "s3": { "endpoint": "http://s3.us-east-1.amazonaws.com", "access_key": "XXXXXXXXXX", "secret": "YYYYYYYYYY", "region": "us-east-1", "host_style": "path", "target_storage_class": "GLACIER", "target_path": "rgwbucket", "acl_mappings": [], "multipart_sync_threshold": 44432, "multipart_min_part_size": 44432 }, "allow_read_through": false, "read_through_restore_days": 10, "restore_storage_class": "COLDTIER", "s3-glacier": { "glacier_restore_days": 2, "glacier_restore_tier_type": "Expedited" } } } ]ブートストラップされたノードで、階層タイプが
cloud-s3のストレージクラスを追加します。注記--tier-type=cloud-s3オプションを使用してストレージクラスを作成すると、後で他のストレージクラスターイプに変更することはできません。構文
radosgw-admin zonegroup placement add --rgw-zonegroup =ZONE_GROUP_NAME \ --placement-id=PLACEMENT_ID \ --storage-class =STORAGE_CLASS_NAME \ --tier-type=cloud-s3例
[ceph: root@host01 /]# radosgw-admin zonegroup placement add --rgw-zonegroup=default \ --placement-id=default-placement \ --storage-class=CLOUDTIER \ --tier-type=cloud-s3 [ { "key": "default-placement", "val": { "name": "default-placement", "tags": [], "storage_classes": [ "CLOUDTIER", "STANDARD" ], "tier_targets": [ { "key": "CLOUDTIER", "val": { "tier_type": "cloud-s3", "storage_class": "CLOUDTIER", "retain_head_object": "false", "s3": { "endpoint": "", "access_key": "", "secret": "", "host_style": "path", "target_storage_class": "", "target_path": "", "acl_mappings": [], "multipart_sync_threshold": 33554432, "multipart_min_part_size": 33554432 } } } ] } } ]storage_classを更新します。注記クラスターがマルチサイトセットアップの一部である場合は、
period update --commitを実行して、ゾーングループの変更がマルチサイト内のすべてのゾーンに伝播されるようにします。注記access_keyとSecretが数字で始まらないようにしてください。必須パラメーターは次のとおりです。
access_key- 特定の接続に使用されるリモートクラウド S3 アクセスキー。
secret- リモートクラウド S3 サービスの秘密鍵。
endpoint- リモートクラウド S3 サービスエンドポイントの URL。
regionAWS のリモートクラウド S3 サービスリージョン名。
オプションのパラメーターは次のとおりです。
target_path-
ターゲットパスの作成方法を定義します。ターゲットパスは、ソース
bucket-name/object-nameが追加される接頭辞を指定します。接頭辞を指定しない場合、作成される target_path はrgwx-ZONE_GROUP_NAME-STORAGE_CLASS_NAME-cloud-bucketです。 target_storage_class- オブジェクトの移行先となるストレージクラスを定義します。接頭辞を指定しない場合、オブジェクトは STANDARD ストレージクラスに移行されます。
retain_head_objectクラウドに移行されたオブジェクトのメタデータを保持するには、
trueに設定します。移行後にオブジェクトを削除するには、falseに設定します。デフォルトの設定はfalseです。注記このオプションは、現在のバージョン管理されたオブジェクトでは無視されます。
multipart_sync_threshold- このサイズ以上のオブジェクトがマルチパートアップロードを使用してクラウドに移行することを指定します。
multipart_min_part_size- マルチパートアップロードを使用してオブジェクトを移行するときに使用する最小パーツサイズを指定します。
glacier_restore_days-
Red Hat Ceph Storage 8.1 以降の
cloud-s3-glacierで使用します。Glacier または Tape エンドポイントでオブジェクトを復元できる日数を指定します。デフォルト設定は1(1 日) です。 glacier_restore_tier_typeRed Hat Ceph Storage 8.1 以降の
cloud-s3-glacierで使用します。復元取得タイプを指定します。オプションは、StandardまたはExpeditedです。デフォルト設定はStandardです。構文
radosgw-admin zonegroup placement modify --rgw-zonegroup ZONE_GROUP_NAME \ --placement-id PLACEMENT_ID \ --storage-class STORAGE_CLASS_NAME \ --tier-config=endpoint=AWS_ENDPOINT_URL,\ access_key=AWS_ACCESS_KEY,secret=AWS_SECRET_KEY,\ target_path="TARGET_BUCKET_ON_AWS",\ multipart_sync_threshold=44432,\ multipart_min_part_size=44432,\ retain_head_object=true region=REGION_NAME例
[ceph: root@host01 /]# radosgw-admin zonegroup placement modify --rgw-zonegroup default --placement-id default-placement \ --storage-class CLOUDTIER \ --tier-config=endpoint=http://10.0.210.010:8080,\ access_key=a21e86bce636c3aa2,secret=cf764951f1fdde5f,\ target_path="dfqe-bucket-01",\ multipart_sync_threshold=44432,\ multipart_min_part_size=44432,\ retain_head_object=true region=us-east-1 [ { "key": "default-placement", "val": { "name": "default-placement", "tags": [], "storage_classes": [ "CLOUDTIER", "STANDARD", "cold.test", "hot.test" ], "tier_targets": [ { "key": "CLOUDTIER", "val": { "tier_type": "cloud-s3", "storage_class": "CLOUDTIER", "retain_head_object": "true", "s3": { "endpoint": "http://10.0.210.010:8080", "access_key": "a21e86bce636c3aa2", "secret": "cf764951f1fdde5f", "region": "", "host_style": "path", "target_storage_class": "", "target_path": "dfqe-bucket-01", "acl_mappings": [], "multipart_sync_threshold": 44432, "multipart_min_part_size": 44432 } } } ] } } ] ]
Ceph Object Gateway を再起動します。
構文
ceph orch restart CEPH_OBJECT_GATEWAY_SERVICE_NAME例
[ceph: root@host 01 /]# ceph orch restart rgw.rgw.1 Scheduled to restart rgw.rgw.1.host03.vkfldf on host 'host03’シェルを終了し、root ユーザーとして、ブートストラップされたノードで Amazon S3 を設定します。
例
[root@host01 ~]# s3cmd --configure Enter new values or accept defaults in brackets with Enter. Refer to user manual for detailed description of all options. Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables. Access Key: a21e86bce636c3aa2 Secret Key: cf764951f1fdde5f Default Region [US]: Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3. S3 Endpoint [s3.amazonaws.com]: 10.0.210.78:80 Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used if the target S3 system supports dns based buckets. DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: 10.0.210.78:80 Encryption password is used to protect your files from reading by unauthorized persons while in transfer to S3 Encryption password: Path to GPG program [/usr/bin/gpg]: When using secure HTTPS protocol all communication with Amazon S3 servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP, and can only be proxied with Python 2.7 or newer Use HTTPS protocol [Yes]: No On some networks all internet access must go through a HTTP proxy. Try setting it here if you can't connect to S3 directly HTTP Proxy server name: New settings: Access Key: a21e86bce636c3aa2 Secret Key: cf764951f1fdde5f Default Region: US S3 Endpoint: 10.0.210.78:80 DNS-style bucket+hostname:port template for accessing a bucket: 10.0.210.78:80 Encryption password: Path to GPG program: /usr/bin/gpg Use HTTPS protocol: False HTTP Proxy server name: HTTP Proxy server port: 0 Test access with supplied credentials? [Y/n] Y Please wait, attempting to list all buckets... Success. Your access key and secret key worked fine :-) Now verifying that encryption works... Not configured. Never mind. Save settings? [y/N] y Configuration saved to '/root/.s3cfg'S3 バケットを作成します。
構文
s3cmd mb s3://NAME_OF_THE_BUCKET_FOR_S3例
[root@host01 ~]# s3cmd mb s3://awstestbucket Bucket 's3://awstestbucket/' createdファイルを作成し、すべてのデータを入力して、S3 サービスに移動します。
構文
s3cmd put FILE_NAME s3://NAME_OF_THE_BUCKET_ON_S3例
[root@host01 ~]# s3cmd put test.txt s3://awstestbucket upload: 'test.txt' -> 's3://awstestbucket/test.txt' [1 of 1] 21 of 21 100% in 1s 16.75 B/s doneライフサイクル設定移行ポリシーを作成します。
構文
<LifecycleConfiguration> <Rule> <ID>RULE_NAME</ID> <Filter> <Prefix></Prefix> </Filter> <Status>Enabled</Status> <Transition> <Days>DAYS</Days> <StorageClass>STORAGE_CLASS_NAME</StorageClass> </Transition> </Rule> </LifecycleConfiguration>例
[root@host01 ~]# cat lc_cloud.xml <LifecycleConfiguration> <Rule> <ID>Archive all objects</ID> <Filter> <Prefix></Prefix> </Filter> <Status>Enabled</Status> <Transition> <Days>2</Days> <StorageClass>CLOUDTIER</StorageClass> </Transition> </Rule> </LifecycleConfiguration>ライフサイクル設定移行ポリシーを設定します。
構文
s3cmd setlifecycle FILE_NAME s3://NAME_OF_THE_BUCKET_FOR_S3例
[root@host01 ~]# s3cmd setlifecycle lc_config.xml s3://awstestbucket s3://awstestbucket/: Lifecycle Policy updatedcephadm shellにログインします。例
[root@host 01 ~]# cephadm shellCeph Object Gateway を再起動します。
構文
ceph orch restart CEPH_OBJECT_GATEWAY_SERVICE_NAME例
[ceph: root@host 01 /]# ceph orch restart rgw.rgw.1 Scheduled to restart rgw.rgw.1.host03.vkfldf on host 'host03’
検証
ソースクラスターで、
radosgw-admin lc listコマンドを使用して、データが S3 に移動したかどうかを確認します。例
[ceph: root@host01 /]# radosgw-admin lc list [ { "bucket": ":awstestbucket:552a3adb-39e0-40f6-8c84-00590ed70097.54639.1", "started": "Mon, 26 Sep 2022 18:32:07 GMT", "status": "COMPLETE" } ]クラウドエンドポイントでのオブジェクトの移行を確認します。
例
[root@client ~]$ radosgw-admin bucket list [ "awstestbucket" ]バケット内のオブジェクトを一覧表示します。
例
[root@host01 ~]$ aws s3api list-objects --bucket awstestbucket --endpoint=http://10.0.209.002:8080 { "Contents": [ { "Key": "awstestbucket/test", "LastModified": "2022-08-25T16:14:23.118Z", "ETag": "\"378c905939cc4459d249662dfae9fd6f\"", "Size": 29, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-user", "ID": "test-user" } } ] }S3 バケットの内容を一覧表示します。
例
[root@host01 ~]# s3cmd ls s3://awstestbucket 2022-08-25 09:57 0 s3://awstestbucket/test.txtファイルの情報を確認します。
例
[root@host01 ~]# s3cmd info s3://awstestbucket/test.txt s3://awstestbucket/test.txt (object): File size: 0 Last mod: Mon, 03 Aug 2022 09:57:49 GMT MIME type: text/plain Storage: CLOUDTIER MD5 sum: 991d2528bb41bb839d1a9ed74b710794 SSE: none Policy: none CORS: none ACL: test-user: FULL_CONTROL x-amz-meta-s3cmd-attrs: atime:1664790668/ctime:1664790668/gid:0/gname:root/md5:991d2528bb41bb839d1a9ed74b710794/mode:33188/mtime:1664790668/uid:0/uname:rootAmazon S3 からローカルにデータをダウンロードします。
AWS を設定します。
例
[client@client01 ~]$ aws configure AWS Access Key ID [****************6VVP]: AWS Secret Access Key [****************pXqy]: Default region name [us-east-1]: Default output format [json]:AWS バケットの内容を一覧表示します。
例
[client@client01 ~]$ aws s3 ls s3://dfqe-bucket-01/awstest PRE awstestbucket/S3 からデータをダウンロードします。
例
[client@client01 ~]$ aws s3 cp s3://dfqe-bucket-01/awstestbucket/test.txt . download: s3://dfqe-bucket-01/awstestbucket/test.txt to ./test.txt