검색

9.14. Amazon S3 클라우드 서비스로 데이터 전환

download PDF

스토리지 클래스를 사용하여 라이프사이클 구성의 일부로 데이터를 원격 클라우드 서비스로 전환하여 비용을 줄이고 관리 효율성을 개선할 수 있습니다. 전환은 단방향이며 데이터는 원격 영역에서 다시 전환할 수 없습니다. 이 기능은 Amazon(S3)과 같은 여러 클라우드 공급자로 데이터 전환을 활성화하는 것입니다.

cloud-s3계층 유형으로 사용하여 데이터를 전환해야 하는 원격 클라우드 S3 오브젝트 저장소 서비스를 구성합니다. 여기에는 데이터 풀이 필요하지 않으며 zonegroup 배치 대상의 관점에서 정의됩니다.

사전 요구 사항

  • Ceph Object Gateway가 설치된 Red Hat Ceph Storage 클러스터입니다.
  • 원격 클라우드 서비스에 대한 사용자 인증 정보, Amazon S3.
  • Amazon S3에서 생성된 대상 경로입니다.
  • 부트스트랩 노드에 s3cmd 가 설치되어 있어야 합니다.
  • Amazon AWS는 데이터를 다운로드하도록 로컬로 구성되었습니다.

프로세스

  1. 액세스 키와 시크릿 키가 있는 사용자를 생성합니다.

    구문

    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": []
    }

  2. 부트스트랩된 노드에서 계층 유형이 있는 스토리지 클래스를 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
                            }
                        }
                    }
                ]
            }
        }
    ]

  3. update storage_class:

    참고

    클러스터가 다중 사이트 설정의 일부인 경우 period update --commit 를 실행하여 zonegroup 변경 사항이 다중 사이트의 모든 영역으로 전파됩니다.

    참고

    access_keysecret 이 숫자로 시작하지 않는지 확인합니다.

    필수 매개변수는 다음과 같습니다.

    • access_key 는 특정 연결에 사용되는 원격 클라우드 S3 액세스 키입니다.
    • Secret 은 원격 클라우드 S3 서비스의 시크릿 키입니다.
    • endpoint 는 원격 클라우드 S3 서비스 끝점의 URL입니다.
    • 리전 (AWS의 경우)은 원격 클라우드 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인 경우 cloud로 전환된 오브젝트의 메타데이터를 유지합니다. false(기본값)인 경우 오브젝트는 전환 후 삭제됩니다. 이 옵션은 현재 버전이 지정된 오브젝트에서 무시됩니다.
    • multipart_sync_threshold 는 이 크기 이상의 오브젝트가 다중 파트 업로드를 사용하여 클라우드로 전환되도록 지정합니다.
    • multipart_min_part_size 는 multipart 업로드를 사용하여 오브젝트를 전환할 때 사용할 최소 부분 크기를 지정합니다.

      구문

      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
                              }
                          }
                      }
                  ]
              }
          }
      ]
      ]

  4. 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’

  5. 쉘을 종료하고 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'

  6. S3 버킷을 생성합니다.

    구문

    s3cmd mb s3://NAME_OF_THE_BUCKET_FOR_S3

    예제

    [root@host01 ~]# s3cmd mb s3://awstestbucket
    Bucket 's3://awstestbucket/' created

  7. 파일을 생성하고 모든 데이터를 입력하고 이를 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

  8. 라이프사이클 구성 전환 정책을 생성합니다.

    구문

    <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>

  9. 라이프사이클 구성 전환 정책을 설정합니다.

    구문

    s3cmd setlifecycle FILE_NAME s3://NAME_OF_THE_BUCKET_FOR_S3

    예제

    [root@host01 ~]#  s3cmd setlifecycle lc_config.xml s3://awstestbucket
    
    s3://awstestbucket/: Lifecycle Policy updated

  10. cephadm 쉘에 로그인합니다.

    예제

    [root@host 01 ~]# cephadm shell

  11. 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’

검증

  1. 소스 클러스터에서 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"
        }
    ]

  2. 클라우드 끝점에서 오브젝트 전환을 확인합니다.

    예제

    [root@client ~]$ radosgw-admin bucket list
    [
        "awstestbucket"
    ]

  3. 버킷의 오브젝트를 나열합니다.

    예제

    [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"
                }
            }
        ]
    }

  4. S3 버킷의 콘텐츠를 나열합니다.

    예제

    [root@host01 ~]# s3cmd ls s3://awstestbucket
    2022-08-25 09:57            0  s3://awstestbucket/test.txt

  5. 파일의 정보를 확인합니다.

    예제

    [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:root

  6. Amazon S3에서 로컬로 데이터를 다운로드합니다.

    1. 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]:

    2. AWS 버킷의 콘텐츠를 나열합니다.

      예제

      [client@client01 ~]$ aws s3 ls s3://dfqe-bucket-01/awstest
      PRE awstestbucket/

    3. S3에서 데이터를 다운로드합니다.

      예제

      [client@client01 ~]$ aws s3 cp s3://dfqe-bucket-01/awstestbucket/test.txt .
      
      download: s3://dfqe-bucket-01/awstestbucket/test.txt to ./test.txt

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.