11.2. Red Hat Quay 복원
이 절차는 Red Hat Quay Operator가 데이터베이스를 관리할 때 Red Hat Quay를 복원하는 데 사용됩니다. Red Hat Quay 레지스트리의 백업 후 수행해야 합니다. 자세한 내용은 Red Hat Quay 백업을 참조하십시오.
사전 요구 사항
- Red Hat Quay는 Red Hat Quay Operator를 사용하여 OpenShift Container Platform에 배포됩니다.
- Red Hat Quay Operator에서 관리하는 Red Hat Quay 구성의 백업은 Red Hat Quay 섹션의 지침에 따라 생성되었습니다.
- Red Hat Quay 데이터베이스가 백업되었습니다.
- Red Hat Quay에서 사용하는 오브젝트 스토리지 버킷이 백업되었습니다.
-
구성 요소
quay,postgres및objectstorage는managed: true로 설정됩니다. -
구성 요소
clair가managed: true로 설정된 경우 구성 요소clairpostgres도managed: true로 설정됩니다(Red Hat Quay Operator v3.7 이상으로 시작) - OpenShift Container Platform 클러스터의 대상 네임스페이스에서 Red Hat Quay Operator에서 관리하는 실행 중인 Red Hat Quay 배포가 없습니다.
배포에 부분적으로 관리되지 않는 데이터베이스 또는 스토리지 구성 요소가 포함되어 있고 Postgres 또는 S3 호환 오브젝트 스토리지에 외부 서비스를 사용하여 Red Hat Quay 배포를 실행하는 경우, Red Hat Quay를 복원하기 전에 백업에서 데이터를 복원하려면 서비스 공급자 또는 공급 업체 설명서를 참조해야 합니다.
11.2.1. Red Hat Quay 및 백업에서 구성 복원 링크 복사링크가 클립보드에 복사되었습니다!
이 지침에서는 Red Hat Quay 백업 가이드의 프로세스를 따라 동일한 이름으로 백업 파일을 생성한다고 가정합니다.
백업된 Red Hat Quay 구성 및 백업에서 생성된 키를 복원합니다.
$ oc create -f ./config-bundle.yaml $ oc create -f ./managed-secret-keys.yaml중요"./config-bundle.yaml": secrets "config-bundle-secret"을 생성할 때 오류 발생 (AlreadyExists): 오류가 발생하면.yaml로 다시 생성해야 합니다.$ oc delete Secret config-bundle-secret-n <quay-namespace>를 사용하여 기존 리소스를 삭제하고$ oc create -f./config-bundle.yamlQuayRegistry사용자 정의 리소스를 복원합니다.$ oc create -f ./quay-registry.yamlRed Hat Quay 배포 상태를 확인하고 사용 가능할 때까지 기다립니다.
$ oc wait quayregistry registry --for=condition=Available=true -n <quay-namespace>
11.2.2. Red Hat Quay 배포 축소 링크 복사링크가 클립보드에 복사되었습니다!
Operator 버전 3.7 이상: 자동 스케일링을 비활성화하고 Quay, 미러 작업자 및 Clair(관리된 경우)의 복제본 수를 재정의하여 Red Hat Quay 배포를 축소합니다.
QuayRegistry리소스는 다음과 유사해야 합니다.apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: registry namespace: ns spec: components: … - kind: horizontalpodautoscaler managed: false1 - kind: quay managed: true overrides:2 replicas: 0 - kind: clair managed: true overrides: replicas: 0 - kind: mirror managed: true overrides: replicas: 0 …Operator 버전 3.6 이하의 경우: Red Hat Quay Operator를 먼저 축소한 다음 관리되는 Red Hat Quay 리소스를 확장하여 Red Hat Quay 배포를 축소합니다.
$ oc scale --replicas=0 deployment $(oc get deployment -n <quay-operator-namespace>|awk '/^quay-operator/ {print $1}') -n <quay-operator-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/quay-app/ {print $1}') -n <quay-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/quay-mirror/ {print $1}') -n <quay-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/clair-app/ {print $1}') -n <quay-namespace>registry-quay-app,registry-quay-mirror및registry-clair-appPod(Operator에서 관리하도록 설정한 구성 요소에 따라)가 사라질 때까지 기다립니다. 다음 명령을 실행하여 상태를 확인할 수 있습니다.$ oc get pods -n <quay-namespace>출력 예:
registry-quay-config-editor-77847fc4f5-nsbbv 1/1 Running 0 9m1s registry-quay-database-66969cd859-n2ssm 1/1 Running 0 6d1h registry-quay-redis-7cc5f6c977-956g8 1/1 Running 0 5d21h
11.2.3. Red Hat Quay 데이터베이스 복원 링크 복사링크가 클립보드에 복사되었습니다!
Quay 데이터베이스 포드를 식별합니다.
$ oc get pod -l quay-component=postgres -n <quay-namespace> -o jsonpath='{.items[0].metadata.name}'출력 예:
quayregistry-quay-database-59f54bb7-58xs7로컬 환경 및 Pod에 백업을 복사하여 백업을 업로드합니다.
$ oc cp ./backup.sql -n <quay-namespace> registry-quay-database-66969cd859-n2ssm:/tmp/backup.sql데이터베이스에 대한 원격 터미널을 엽니다.
$ oc rsh -n <quay-namespace> registry-quay-database-66969cd859-n2ssmpsql을 입력합니다.
bash-4.4$ psql다음 명령을 실행하여 데이터베이스를 나열할 수 있습니다.
postgres=# \l출력 예:
List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ----------------------------+----------------------------+----------+------------+------------+----------------------- postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | quayregistry-quay-database | quayregistry-quay-database | UTF8 | en_US.utf8 | en_US.utf8 |데이터베이스를 삭제합니다.
postgres=# DROP DATABASE "quayregistry-quay-database";출력 예:
DROP DATABASEpostgres CLI를 종료하여 bash-4.4를 다시 입력합니다.
\qPostgreSQL 데이터베이스를 백업 데이터베이스로 리디렉션합니다.
sh-4.4$ psql < /tmp/backup.sqlbash를 종료합니다.
sh-4.4$ exit
11.2.4. Red Hat Quay 오브젝트 스토리지 데이터 복원 링크 복사링크가 클립보드에 복사되었습니다!
AWS_ACCESS_KEY_ID를 내보냅니다.$ export AWS_ACCESS_KEY_ID=$(oc get secret -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.AWS_ACCESS_KEY_ID}' |base64 -d)AWS_SECRET_ACCESS_KEY내보내기:$ export AWS_SECRET_ACCESS_KEY=$(oc get secret -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.AWS_SECRET_ACCESS_KEY}' |base64 -d)다음 명령을 실행하여 모든 Blob을 버킷에 업로드합니다.
$ aws s3 sync --no-verify-ssl --endpoint https://$(oc get route s3 -n openshift-storage -o jsonpath='{.spec.host}') ./blobs s3://$(oc get cm -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.BUCKET_NAME}')
11.2.5. Red Hat Quay 배포 확장 링크 복사링크가 클립보드에 복사되었습니다!
Operator 버전 3.7 이상: 필요에 따라 자동 스케일링을 재활성화하고 Quay, 미러 작업자 및 Clair에 대한 복제본 덮어쓰기를 제거하여 Red Hat Quay 배포를 확장합니다.
QuayRegistry리소스는 다음과 유사해야 합니다.apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: registry namespace: ns spec: components: … - kind: horizontalpodautoscaler managed: true1 - kind: quay2 managed: true - kind: clair managed: true - kind: mirror managed: true …Operator 버전 3.6 이하의 경우: Red Hat Quay Operator를 다시 확장하여 Red Hat Quay 배포를 확장합니다.
$ oc scale --replicas=1 deployment $(oc get deployment -n <quay-operator-namespace> | awk '/^quay-operator/ {print $1}') -n <quay-operator-namespace>Red Hat Quay 배포 상태를 확인합니다.
$ oc wait quayregistry registry --for=condition=Available=true -n <quay-namespace>출력 예:
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: ... name: registry namespace: <quay-namespace> ... spec: ... status: - lastTransitionTime: '2022-06-20T05:31:17Z' lastUpdateTime: '2022-06-20T17:31:13Z' message: All components reporting as healthy reason: HealthChecksPassing status: 'True' type: Available