Cloud Object Storage(COS) 앱 및 데이터를 IBM Cloud 계정 간에 마이그레이션하기
클래식 인프라스트럭처 가상 사설 클라우드
이 튜토리얼에서는 한 계정의 IBM Cloud Kubernetes Service 클러스터에서 별도의 계정의 Red Hat OpenShift on IBM Cloud 클러스터로 COS 앱과 데이터를 마이그레이션하는 방법을 설명합니다.
전제조건
계정 1
계정 1에는 다음이 필요합니다.
-
IBM Cloud Kubernetes Service 클러스터입니다.
-
COS 인스턴스 및 HMAC 자격 증명 집합입니다. 자세한 내용은 다음을 참조하세요. 서비스 자격 증명.
-
클러스터에 설치된 COS 플러그인 입니다.
계정 2
마이그레이션할 대상 계정인 계정 2에는 다음이 있어야 합니다.
선택 사항: 클러스터에 애플리케이션 배포
계정 1
마이그레이션하려는 앱이 아직 없는 경우 다음 예제 앱을 배포할 수 있습니다.
-
개체 스토리지 구성을 참조하는 PVC를 만듭니다.
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: demo #Enter a name for your PVC. namespace: default annotations: ibm.io/auto-create-bucket: "true" ibm.io/auto-delete-bucket: "false" ibm.io/secret-name: SECRET-NAME #Enter the name of the secret you created earlier. ibm.io/secret-namespace: NAMESPACE #Enter the namespace where you want to create the PVC. spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: ibmc-s3fs-cos #The storage class that you want to use. -
클러스터에 PVC를 작성하십시오.
oc apply -f pvc-cos.yaml -
생성한 PVC를 마운트하는 포드용 YAML 구성 파일을 생성합니다.
apiVersion: v1 kind: Pod metadata: name: demo-pod namespace: default spec: securityContext: runAsUser: 2000 fsGroup: 2000 volumes: - name: demo-vol persistentVolumeClaim: claimName: demo containers: - name: test image: nginxinc/nginx-unprivileged imagePullPolicy: Always volumeMounts: - name: demo-vol mountPath: /mnt/cosvol -
클러스터에서 팟(Pod)을 작성하십시오.
oc apply -f demo-pod.yaml -
팟(Pod)이 배치되었는지 확인하십시오. 앱이
Running상태가 되는 데 몇 분 정도 걸릴 수 있습니다.oc get podsNAME READY STATUS RESTARTS AGE demo-pod 1/1 Running 0 2m58s -
팟(Pod)에 로그인하여 앱이 블록 스토리지 볼륨에 쓸 수 있는지 확인하십시오.
oc exec demo-pod -- bash -c "ls /mnt/cosvol"
앱의 세부 정보를 확인하세요
계정 1
- 파드와 PVC를 나열합니다.
oc get pods - PVC에 대해 설명하고 세부 사항을 검토한 후 버킷 이름을 메모합니다.
oc describe PVC -o yaml
설치 rclone
설치 단계 에 대한 rclone 문서를 따르세요.
계정 1의 버킷에 ' rclone '을 구성합니다
계정 1
rclone 을 설치한 후에는 데이터를 마이그레이션할 COS 인스턴스를 정의하는 구성 파일을 생성해야 합니다.
-
rclone config명령을 실행하십시오.rclone config출력 예
2020/01/16 09:39:33 NOTICE: Config file "/Users/ryan/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config -
입력하다
n새 리모컨을 설정하려면 리모컨의 이름을 입력하세요.n/s/q> n원격 이름 예시
name> cos-instance-1 -
공급자 목록에서 다음을 선택하세요.
Amazon S3 Compliant Storage Provider이는 다음을 포함합니다IBM COS.Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" ... provider> 4 -
제공자로 s3
IBM COS선택하십시오.Choose your S3 provider. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Amazon Web Services (AWS) S3 \ "AWS" 2 / Alibaba Cloud Object Storage System (OSS) formerly Aliyun \ "Alibaba" 3 / Ceph Object Storage \ "Ceph" 4 / Digital Ocean Spaces \ "DigitalOcean" 5 / Dreamhost DreamObjects \ "Dreamhost" 6 / IBM COS S3 \ "IBMCOS" 7 / Minio Object Storage \ "Minio" 8 / Netease Object Storage (NOS) \ "Netease" 9 / Wasabi Object Storage \ "Wasabi" 10 / Any other S3 compatible provider \ "Other" -
옵션을 선택하여 COS 자격 증명을 추가하세요.
1.Option env_auth. Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars). Only applies if access_key_id and secret_access_key is blank. Choose a number from below, or type in your own boolean value (true or false). Press Enter for the default (false). 1 / Enter AWS credentials in the next step. \ (false) 2 / Get AWS credentials from the environment (env vars or IAM). \ (true) env_auth> 1 -
메시지가 표시되면 다음을 제공하세요.
access_key_id그리고secret_access_keyCOS 인스턴스의 자세한 내용은 다음을 참조하세요. 서비스 자격 증명.AWS Access Key ID. Leave blank for anonymous access or runtime credentials. Enter a string value. Press Enter for the default (""). access_key_id> xxxxxxxxxxxxxxxxxxxxx AWS Secret Access Key (password) Leave blank for anonymous access or runtime credentials. Enter a string value. Press Enter for the default (""). secret_access_key> xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
에서
Region to connect to프롬프트, 옵션 선택1.Region to connect to. Leave blank if you are using an S3 clone and you don't have a region. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Use this if unsure. Will use v4 signatures and an empty region. \ "" 2 / Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH. \ "other-v2-signature" region> 1 -
에서
Endpoint for IBM COS S3 API프롬프트, 옵션 선택1.Endpoint for IBM COS S3 API. Specify if using an IBM COS On Premise. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / US Cross Region Endpoint \ "s3-api.us-geo.objectstorage.softlayer.net" 2 / US Cross Region Dallas Endpoint \ "s3-api.dal.us-geo.objectstorage.softlayer.net" 3 / US Cross Region Washington DC Endpoint \ "s3-api.wdc-us-geo.objectstorage.softlayer.net" ... endpoint> 1 -
에서
Location constraint프롬프트, 누르다 반품 기본값을 사용합니다.Location constraint - must match endpoint when using IBM Cloud Public. For on-prem COS, do not make a selection from this list, hit enter Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / US Cross Region Standard \ "us-standard" 2 / US Cross Region Vault \ "us-vault" 3 / US Cross Region Cold \ "us-cold" 4 / US Cross Region Flex \ "us-flex" ... -
ACL 정책 프롬프트에서 다음을 선택합니다.
private.Note that this ACL is applied when server side copying objects as S3 doesn't copy the ACL from the source but rather writes a fresh one. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Owner gets FULL_CONTROL. No one else has access rights (default). This acl is available on IBM Cloud (Infra), IBM Cloud (Storage), On-Premise COS \ "private" 2 / Owner gets FULL_CONTROL. The AllUsers group gets READ access. This acl is available on IBM Cloud (Infra), IBM Cloud (Storage), On-Premise IBM COS \ "public-read" 3 / Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access. This acl is available on IBM Cloud (Infra), On-Premise IBM COS \ "public-read-write" 4 / Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access. Not supported on Buckets. This acl is available on IBM Cloud (Infra) and On-Premise IBM COS \ "authenticated-read" acl> 1 -
고급 구성 옵션을 건너뛰고 설정을 확인하세요.
Edit advanced config? (y/n) y) Yes n) No y/n> n Remote config -------------------- [cos-instance-1] type = s3 provider = IBMCOS env_auth = false access_key_id = xxxxxx secret_access_key = xxxxxxxxx endpoint = s3-api.us-geo.objectstorage.softlayer.net location_constraint = us-standard acl = private -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type ==== ==== cos-instance-1 s3 -
이전 단계를 반복하여 두 번째 계정에 COS 인스턴스를 추가합니다. 정보를 확인했으면
q을 눌러 구성 프로세스를 종료합니다.
계정 2에서 버킷에 ' rclone '을 구성합니다
계정 2
단계를 반복하여 계정 2에 대해 rclone 을 구성합니다.
-
rclone config명령을 실행하십시오.rclone config출력 예
2020/01/16 09:39:33 NOTICE: Config file "/Users/ryan/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config -
입력하다
n새 리모컨을 설정하려면 리모컨의 이름을 입력하세요.n/s/q> n원격 이름 예시
name> cos-instance-2 -
공급자 목록에서 다음을 선택하세요.
Amazon S3 Compliant Storage Provider이는 다음을 포함합니다IBM COS.Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" ... provider> 4 -
제공자로 s3
IBM COS선택하십시오.Choose your S3 provider. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Amazon Web Services (AWS) S3 \ "AWS" 2 / Alibaba Cloud Object Storage System (OSS) formerly Aliyun \ "Alibaba" 3 / Ceph Object Storage \ "Ceph" 4 / Digital Ocean Spaces \ "DigitalOcean" 5 / Dreamhost DreamObjects \ "Dreamhost" 6 / IBM COS S3 \ "IBMCOS" 7 / Minio Object Storage \ "Minio" 8 / Netease Object Storage (NOS) \ "Netease" 9 / Wasabi Object Storage \ "Wasabi" 10 / Any other S3 compatible provider \ "Other" -
옵션을 선택하여 COS 자격 증명을 추가하세요.
1.Option env_auth. Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars). Only applies if access_key_id and secret_access_key is blank. Choose a number from below, or type in your own boolean value (true or false). Press Enter for the default (false). 1 / Enter AWS credentials in the next step. \ (false) 2 / Get AWS credentials from the environment (env vars or IAM). \ (true) env_auth> 1 -
메시지가 표시되면 다음을 제공하세요.
access_key_id그리고secret_access_keyCOS 인스턴스의 자세한 내용은 다음을 참조하세요. 서비스 자격 증명.AWS Access Key ID. Leave blank for anonymous access or runtime credentials. Enter a string value. Press Enter for the default (""). access_key_id> xxxxxxxxxxxxxxxxxxxxx AWS Secret Access Key (password) Leave blank for anonymous access or runtime credentials. Enter a string value. Press Enter for the default (""). secret_access_key> xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
에서
Region to connect to프롬프트, 옵션 선택1.Region to connect to. Leave blank if you are using an S3 clone and you don't have a region. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Use this if unsure. Will use v4 signatures and an empty region. \ "" 2 / Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH. \ "other-v2-signature" region> 1 -
에서
Endpoint for IBM COS S3 API프롬프트, 옵션 선택1.Endpoint for IBM COS S3 API. Specify if using an IBM COS On Premise. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / US Cross Region Endpoint \ "s3-api.us-geo.objectstorage.softlayer.net" 2 / US Cross Region Dallas Endpoint \ "s3-api.dal.us-geo.objectstorage.softlayer.net" 3 / US Cross Region Washington DC Endpoint \ "s3-api.wdc-us-geo.objectstorage.softlayer.net" ... endpoint> 1 -
에서
Location constraint프롬프트, 누르다 반품 기본값을 사용합니다.Location constraint - must match endpoint when using IBM Cloud Public. For on-prem COS, do not make a selection from this list, hit enter Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / US Cross Region Standard \ "us-standard" 2 / US Cross Region Vault \ "us-vault" 3 / US Cross Region Cold \ "us-cold" 4 / US Cross Region Flex \ "us-flex" ... -
ACL 정책 프롬프트에서 다음을 선택합니다.
private.Note that this ACL is applied when server side copying objects as S3 doesn't copy the ACL from the source but rather writes a fresh one. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Owner gets FULL_CONTROL. No one else has access rights (default). This acl is available on IBM Cloud (Infra), IBM Cloud (Storage), On-Premise COS \ "private" 2 / Owner gets FULL_CONTROL. The AllUsers group gets READ access. This acl is available on IBM Cloud (Infra), IBM Cloud (Storage), On-Premise IBM COS \ "public-read" 3 / Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access. This acl is available on IBM Cloud (Infra), On-Premise IBM COS \ "public-read-write" 4 / Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access. Not supported on Buckets. This acl is available on IBM Cloud (Infra) and On-Premise IBM COS \ "authenticated-read" acl> 1 -
고급 구성 옵션을 건너뛰고 설정을 확인하세요.
Edit advanced config? (y/n) y) Yes n) No y/n> n Remote config -------------------- [cos-instance-2] type = s3 provider = IBMCOS env_auth = false access_key_id = xxxxxx secret_access_key = xxxxxxxxx endpoint = s3-api.us-geo.objectstorage.softlayer.net location_constraint = us-standard acl = private -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type ==== ==== cos-instance-1 s3 cos-instance-2 s3 -
이전 단계를 반복하여 두 번째 계정에 COS 인스턴스를 추가합니다. 정보를 확인했으면
q을 눌러 구성 프로세스를 종료합니다.
COS 버킷의 콘텐츠 보기
계정 1 계정 2
rclone 을 구성한 후 각 버킷의 콘텐츠를 검토한 다음 각 계정의 버킷 간에 데이터를 동기화합니다.
-
첫 번째 인스턴스에서 버킷의 내용을 봅니다.
rclone ls cos-instance-1:bucket-1 45338 test.txt -
인스턴스 2의 버킷 내용을 봅니다. 이 예에서 버킷 이름은
bucket-2입니다.rclone ls cos-instance-2:bucket-2
버킷 간 콘텐츠 동기화
계정 1 계정 2
-
한 버킷에서 다른 버킷으로 데이터를 이동하려면 다음을 사용할 수 있습니다.
rclone sync명령. 이 예에서는cos-instance-1:bucket-1한 계정에 있는 동안cos-instance-2:bucket-2별도의 계정에 있는 COS의 두 번째 인스턴스입니다.예
rclone sync -P cos-instance-1:bucket-1 cos-instance-2:bucket-2출력 예
Transferred: 754.933k / 754.933 kBytes, 100%, 151.979 kBytes/s, ETA 0s Errors: 0 Checks: 0 / 0, - Transferred: 18 / 18, 100% Elapsed time: 4.9 -
버킷의 내용을 확인하세요.
cos-instance-1버킷에 동기화되었습니다.cos-instance-2.rclone ls cos-instance-2:bucket-2출력 예
45338 test.txt
계정 2에서 앱 재배포
계정 2
-
다음 PVC를 복사하여 다음과 같은 이름의 파일에 저장하십시오.
pvc.yamlkind: PersistentVolumeClaim apiVersion: v1 metadata: name: demo # Enter a name for your PVC. namespace: default annotations: ibm.io/bucket-name: "bucket-2" # Enter the name of the bucket in Account 2 ibm.io/auto-create-bucket: "false" ibm.io/auto-delete-bucket: "false" ibm.io/secret-name: SECRET-NAME #Enter the name of the secret you created earlier. ibm.io/secret-namespace: NAMESPACE #Enter the namespace where you want to create the PVC. spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: ibmc-s3fs-cos #The storage class that you want to use. -
클러스터에 PVC를 작성하십시오.
oc apply -f pvc.yaml -
생성한 PVC를 마운트하는 포드용 YAML 구성 파일을 생성합니다.
apiVersion: v1 kind: Pod metadata: name: demo-pod namespace: default spec: securityContext: runAsUser: 2000 fsGroup: 2000 volumes: - name: demo-vol persistentVolumeClaim: claimName: demo containers: - name: test image: nginxinc/nginx-unprivileged imagePullPolicy: Always volumeMounts: - name: demo-vol mountPath: /mnt/cosvol -
클러스터에서 팟(Pod)을 작성하십시오.
oc apply -f demo-pod.yaml -
팟(Pod)이 배치되었는지 확인하십시오. 앱이
Running상태가 되는 데 몇 분 정도 걸릴 수 있습니다.oc get podsNAME READY STATUS RESTARTS AGE demo-pod 1/1 Running 0 2m58s -
팟(Pod)에 로그인하여 앱이 블록 스토리지 볼륨에 쓸 수 있는지 확인하십시오.
oc exec demo-pod -- bash -c "ls /mnt/cosvol"test.txt