Linux on Power ( ppc64le ) 에서 Postgres 데이터 저장소 생성하기
Postgres 운영자를 설치하고 데이터 저장소를 설정하십시오.
시작하기 전에
외부 저장소에서 이미지를 가져오기 위해 온라인 및 오프라인 호스트를 준비했는지 확인하십시오. 또한 올바른 Helm 저장소가 추가되었는지 확인하십시오.
자세한 내용은 ‘데이터 스토어 설치 준비’를 참조하십시오.
Postgres 배포용 운영체제 버전 및 이미지 태그
고정된 Helm 차트 또는 운영자 버전에는 다음 이미지가 필요합니다.
CNPG Postgres
| 플랫폼 | 오퍼레이터 버전 | Helm 차트 버전 | 태그가 있는 이미지 |
|---|---|---|---|
| Linux® on Power® (ppc64le) | v1.29.1 | 0.28.2 | artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg: v1.29.1_v0.34.0 artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers: 15_v0.39.0 |
Zalando Postgres
| 플랫폼 | 오퍼레이터 버전 | Helm 차트 버전 | 태그가 있는 이미지 |
|---|---|---|---|
| Linux® on Power® (ppc64le) | 1.10.0 | v1.10.1 | artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando: v1.10.0_v0.1.0 artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando: 15.7_v0.1.0 |
Postgres 온라인 설치
온라인 환경에 Postgres 운영자를 설치하십시오.
CloudNativePG 연산자를 사용하여 Postgres 설치하기
Postgres 데이터 스토어를 설치하려면 다음 단계를 따르십시오.
instana-postgres네임스페이스를 작성하십시오.kubectl create namespace instana-postgresinstana-postgres네임스페이스에 대한 이미지 풀 시크릿을 만듭니다.kubectl create secret docker-registry instana-registry --namespace instana-postgres \ --docker-username=_ \ --docker-password=<download_key> \ --docker-server=artifact-public.instana.ioRed Hat® OpenShift® 클러스터에 Postgres 를 설치하는 경우,
instana-postgres네임스페이스에서 파일 시스템 그룹 ID를 확인하십시오. Red Hat OpenShift 파일 시스템 그룹이 해당 네임스페이스에 특정한 값의 범위 내에 있어야 합니다.kubectl get namespace instana-postgres -o yaml이 명령어를 실행하면 다음과 유사한 결과가 표시됩니다:
apiVersion: v1 kind: Namespace metadata: annotations: ....... openshift.io/sa.scc.uid-range: 1000750000/10000 creationTimestamp: "2024-01-14T07:04:59Z" labels: kubernetes.io/metadata.name: instana-postgres ....... name: instana-postgres이
openshift.io/sa.scc.supplemental-groups주석에는 허용되는 ID의 범위가 포함되어 있습니다. 이 범위는 ID 로 시작하는1000750000/1000010,1000750000000개의 값을 나타내므로, 부터1000750000까지의 ID 범위를1000760000지정합니다. 이 예시에서 이 값은 파일 시스템 그룹 ID(1000750000UID)로 사용될 수 있습니다.Postgres 연산자를 설치하십시오. 다음 명령어에서 이전 단계에서
<UID from namespace>얻은 UID를 로 사용하십시오:helm install cnpg instana/cloudnative-pg --set image.repository=artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 --set imagePullSecrets[0].name=instana-registry --set containerSecurityContext.runAsUser=<UID from namespace> --set containerSecurityContext.runAsGroup=<UID from namespace> -n instana-postgresbase64 에서 비밀번호를 생성합니다. 비밀번호를 적어두십시오. 이 내용은 나중에 파일에
config.yaml저장해야 합니다.openssl rand -base64 24 | tr -cd 'a-zA-Z0-9' | head -c32; echo이전 명령어에서 얻은 비밀번호를 사용하여
Secret유형의 리소스를 생성합니다.kind: Secret apiVersion: v1 metadata: name: instanaadmin type: Opaque stringData: username: instanaadmin password: <user-generate-password>Postgres 시크릿을 생성합니다.
kubectl apply -f postgres-secret.yaml -n instana-postgres예를 들어
postgres.yaml, Postgres 클러스터 구성이 포함된 ` YAML ` 파일을 생성합니다.apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: postgres spec: instances: 3 imageName: artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0 imagePullPolicy: IfNotPresent imagePullSecrets: - name: instana-registry postgresql: parameters: shared_buffers: 32MB pg_stat_statements.track: all auto_explain.log_min_duration: '10s' pg_hba: - local all all trust - host all all 0.0.0.0/0 md5 - local replication standby trust - hostssl replication standby all md5 - hostnossl all all all reject - hostssl all all all md5 managed: roles: - name: instanaadmin login: true superuser: true createdb: true createrole: true passwordSecret: name: instanaadmin bootstrap: initdb: database: instanaadmin owner: instanaadmin secret: name: instanaadmin superuserSecret: name: instanaadmin storage: size: 1Gi # storageClass: "Optional"Postgres (온라인 및 오프라인)의 단계를 완료하십시오.
Zalando 연산자를 사용하여 Postgres 설치하기
Zalando Postgres 오퍼레이터를 온라인으로 배포하려면 다음 단계를 수행하십시오:
Red Hat OpenShift 클러스터를 사용하는 경우, Postgres 오퍼레이터를 배포하기 전에 보안 컨텍스트 제약 조건(SCC)을 생성하십시오.
YAML 파일을 생성하고, 예를
postgres-scc.yaml들어 SCC 리소스 정의를 포함시킵니다.apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: name: postgres-scc runAsUser: type: MustRunAs uid: 101 seLinuxContext: type: RunAsAny fsGroup: type: RunAsAny allowHostDirVolumePlugin: false allowHostNetwork: true allowHostPorts: true allowPrivilegedContainer: false allowHostIPC: true allowHostPID: true readOnlyRootFilesystem: false users: - system:serviceaccount:instana-postgres:postgres-operator - system:serviceaccount:instana-postgres:postgres-pod - system:serviceaccount:instana-postgres:defaultSCC 자원을 작성하십시오.
kubectl apply -f postgres-scc.yaml
Postgres 연산자를 설치하십시오.
instana-postgres네임스페이스를 작성하십시오.kubectl create namespace instana-postgresinstana-postgres네임스페이스에 대한 이미지 풀 시크릿을 만듭니다. 다음 명령에서<download_key>값을 상담원 키로 바꿉니다.kubectl create secret docker-registry instana-registry --namespace instana-postgres \ --docker-username=_ \ --docker-password=<download_key> \ --docker-server=artifact-public.instana.io예를 들어
values.yaml, ` Postgres ` 구성을 가진 파일을 생성합니다.configGeneral: kubernetes_use_configmaps: true securityContext: runAsUser: 101 image: registry: artifact-public.instana.io repository: self-hosted-images/3rd-party/operator/zalando tag: v1.10.0_v0.1.0 imagePullSecrets: - name: instana-registry configKubernetes: pod_service_account_definition: | apiVersion: v1 kind: ServiceAccount metadata: name: postgres-pod imagePullSecrets: - name: instana-registry podServiceAccount: name: postgres-podPostgres 연산자를 설치하십시오.
helm install postgres-operator instana/postgres-operator --version=v1.10.1 -f values.yaml -n instana-postgres
postgresql자원 정의를 사용하여 파일 (예:postgres.yaml) 을 작성하십시오.apiVersion: "acid.zalan.do/v1" kind: postgresql metadata: name: postgres spec: patroni: pg_hba: - local all all trust - host all all 0.0.0.0/0 trust - local replication standby trust - hostssl replication standby all trust - hostnossl all all all reject - hostssl all all all trust dockerImage: artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0 teamId: instana numberOfInstances: 3 postgresql: version: "15" parameters: # Expert section shared_buffers: "32MB" volume: size: 10Gi # Uncomment the following line to specify your own storage class, otherwise use the default. # storageClass: <REPLACE>- Postgres (온라인 및 오프라인)의 단계를 완료하십시오.
Postgres 오프라인 설치
오프라인 환경에 Postgres 운영자를 설치하십시오.
CloudNative 의 PG 연산자를 사용하여 Postgres 를 오프라인으로 설치하기
설치 준비시 외부 레지스트리에서 Postgres 이미지를 아직 가져오지 않은 경우 지금 가져올 수 있습니다. bastion 호스트에서 다음 명령을 실행하십시오. 그런 다음, 해당 이미지를 에어갭 환경에 있는 Instana 호스트로 복사하십시오.
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg:v1.29.1_v0.34.0
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0
Instana 호스트에서 다음 단계를 수행하십시오.
이미지를 내부 이미지 레지스트리에 다시 태그 지정하십시오.
docker tag artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg:v1.29.1_v0.34.0 <internal-image-registry>/operator/cloudnative-pg:v1.29.1_v0.34.0 docker tag artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0 <internal-image-registry>/datastore/cnpg-containers:15_v0.39.0배스천 호스트의 내부 이미지 레지스트리에 이미지를 푸시하십시오.
docker push <internal-image-registry>/operator/cloudnative-pg:v1.29.1_v0.34.0 docker push <internal-image-registry>/datastore/cnpg-containers:15_v0.39.0instana-postgres네임스페이스를 작성하십시오.kubectl create namespace instana-postgres선택 사항입니다: 내부 이미지 레지스트리에 인증이 필요한 경우 이미지 풀 시크릿을 생성합니다.
kubectl create secret docker-registry <secret_name> --namespace instana-postgres \ --docker-username=<registry_username> \ --docker-password=<registry_password> \ --docker-server=<internal-image-registry>:<internal-image-registry-port> \ --docker-email=<registry_email>Red Hat® OpenShift® 클러스터에 Postgres 를 설치하는 경우,
instana-postgres네임스페이스에서 파일 시스템 그룹 ID를 확인하십시오. Red Hat OpenShift 파일 시스템 그룹이 해당 네임스페이스에 특정한 값의 범위 내에 있어야 합니다.kubectl get namespace instana-postgres -o yaml이 명령어를 실행하면 다음과 유사한 결과가 표시됩니다:
apiVersion: v1 kind: Namespace metadata: annotations: ....... openshift.io/sa.scc.uid-range: 1000750000/10000 creationTimestamp: "2024-01-14T07:04:59Z" labels: kubernetes.io/metadata.name: instana-postgres ....... name: instana-postgres이
openshift.io/sa.scc.supplemental-groups주석에는 허용되는 ID의 범위가 포함되어 있습니다. 이 범위는 ID 로 시작하는1000750000/1000010,1000750000000개의 값을 나타내므로, 부터1000750000까지의 ID 범위를1000760000지정합니다. 이 예시에서 이 값은 파일 시스템 그룹 ID(1000750000UID)로 사용될 수 있습니다.Postgres 연산자를 설치하십시오. 다음 명령어에서 <download_key> 값을 본인의 에이전트 키로 변경하십시오. 내부 레지스트리를 위해 이미지 풀 시크릿을 생성한 경우, 다음 명령어에 를
--docker-server=<internal-image-registry>:<internal-image-registry-port>추가하세요.Red Hat OpenShift 클러스터
다음 명령어에서 이전
<UID from namespace>단계에서 확인한 UID를 로 사용하십시오:helm install cnpg cloudnative-pg-1.28.0.tgz --set image.repository=image-registry.openshift-image-registry.svc:5000/instana-postgres/cloudnative-pg-operator --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 --set containerSecurityContext.runAsUser=<UID from namespace> --set containerSecurityContext.runAsGroup=<UID from namespace> -n instana-postgresKubernetes 클러스터
helm install cnpg cloudnative-pg-operator --set image.repository=<internal-image-registry>/operator/cloudnative-pg --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 -n instana-postgres
base64 에서 비밀번호를 생성합니다. 비밀번호를 적어두십시오. 이 내용은 나중에 파일에
config.yaml저장해야 합니다.openssl rand -base64 24 | tr -cd 'a-zA-Z0-9' | head -c32; echo이전 명령어에서 얻은 비밀번호를 사용하여
Secret유형의 리소스를 생성합니다.kind: Secret apiVersion: v1 metadata: name: instanaadmin type: Opaque stringData: username: instanaadmin password: <user-generate-password>Postgres 시크릿을 생성합니다.
kubectl apply -f postgres-secret.yaml -n instana-postgres예를 들어
postgres.yaml, Postgres 클러스터 구성이 포함된 ` YAML ` 파일을 생성합니다.apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: postgres spec: instances: 3 imageName: <internal-image-registry>/datastore/cnpg-containers:15_v0.39.0 imagePullPolicy: IfNotPresent # Optional: if you created an image pull secret for your internal registry, uncomment the following lines and update the image pull secret information. # imagePullSecrets: # - name: <internal-image-registry-pull-secret> postgresql: parameters: shared_buffers: 32MB pg_stat_statements.track: all auto_explain.log_min_duration: '10s' pg_hba: - local all all trust - host all all 0.0.0.0/0 md5 - local replication standby trust - hostssl replication standby all md5 - hostnossl all all all reject - hostssl all all all md5 managed: roles: - name: instanaadmin login: true superuser: true createdb: true createrole: true passwordSecret: name: instanaadmin bootstrap: initdb: database: instanaadmin owner: instanaadmin secret: name: instanaadmin superuserSecret: name: instanaadmin storage: size: 1Gi # storageClass: "Optional"- Postgres (온라인 및 오프라인)의 단계를 완료하십시오.
Zalando 명령어를 사용하여 Postgres 를 오프라인으로 설치하기
Red Hat OpenShift 클러스터를 사용하는 경우, Postgres 오퍼레이터를 배포하기 전에 보안 컨텍스트 제약 조건을 생성하십시오.
YAML 파일을 생성하고, 예를
postgres-scc.yaml들어 SCC 리소스 정의를 포함시킵니다.apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: name: postgres-scc runAsUser: type: MustRunAs uid: 101 seLinuxContext: type: RunAsAny fsGroup: type: RunAsAny allowHostDirVolumePlugin: false allowHostNetwork: true allowHostPorts: true allowPrivilegedContainer: false allowHostIPC: true allowHostPID: true readOnlyRootFilesystem: false users: - system:serviceaccount:instana-postgres:postgres-operator - system:serviceaccount:instana-postgres:postgres-pod - system:serviceaccount:instana-postgres:defaultSCC 자원을 작성하십시오.
kubectl apply -f postgres-scc.yaml
그런 다음 Postgres 운영자 설치를 진행하십시오.
설치 준비시 외부 레지스트리에서 Postgres 이미지를 아직 가져오지 않은 경우 지금 가져올 수 있습니다. bastion 호스트에서 다음 명령을 실행하십시오. 그런 다음, 해당 이미지를 에어갭 환경에 있는 Instana 호스트로 복사하십시오.
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
Instana 호스트에서 다음 단계를 수행하십시오.
이미지를 내부 이미지 레지스트리에 다시 태그 지정하십시오.
docker tag artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0 <internal-image-registry>/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0 docker tag artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0 <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0배스천 호스트의 내부 이미지 레지스트리에 이미지를 푸시하십시오.
docker push <internal-image-registry>/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0 docker push <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0예를 들어
values.yaml, ` Postgres ` 구성을 가진 파일을 생성합니다.configGeneral: kubernetes_use_configmaps: true securityContext: runAsUser: 101 image: registry: <internal-image-registry> repository: self-hosted-images/3rd-party/operator/zalando tag: v1.10.0_v0.1.0 imagePullSecrets: - name: instana-registry configKubernetes: pod_service_account_definition: | apiVersion: v1 kind: ServiceAccount metadata: name: postgres-pod imagePullSecrets: - name: instana-registry podServiceAccount: name: postgres-podinstana-postgres네임스페이스를 작성하십시오.kubectl create namespace instana-postgres선택 사항입니다: 내부 이미지 레지스트리에 인증이 필요한 경우 이미지 풀 시크릿을 생성합니다.
kubectl create secret docker-registry <secret_name> --namespace instana-postgres \ --docker-username=<registry_username> \ --docker-password=<registry_password> \ --docker-server=<internal-image-registry>:<internal-image-registry-port> \ --docker-email=<registry_email>Postgres 연산자를 설치하십시오. 이전 단계에서 이미지 풀 시크릿을 만든 경우 다음 명령에
--set imagePullSecrets[0].name="<internal-image-registry-pull-secret>"을 추가합니다.helm install postgres-operator postgres-operator-ppc64le-1.10.0.tgz --version=1.10.0 --set configGeneral.kubernetes_use_configmaps=true --set securityContext.runAsUser=101 --namespace=instana-postgres --set image.registry=<internal-image-registry> --set image.repository=ppc64le-oss/postgres-operator-ppc64le --set image.tag=v1.10.0_v0.1.0postgresql자원 정의를 사용하여 파일 (예:postgres.yaml) 을 작성하십시오.apiVersion: "acid.zalan.do/v1" kind: postgresql metadata: name: postgres spec: patroni: pg_hba: - local all all trust - host all all 0.0.0.0/0 trust - local replication standby trust - hostssl replication standby all trust - hostnossl all all all reject - hostssl all all all trust dockerImage: <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0 teamId: instana numberOfInstances: 3 postgresql: version: "15" parameters: # Expert section shared_buffers: "32MB" volume: size: 10Gi # Uncomment the line below to specify your own storage class, otherwise use the default. # storageClass: <REPLACE>Postgres (온라인 및 오프라인)의 단계를 완료하십시오.
Postgres 배포 및 검증 (온라인 및 오프라인)
Postgres 인스턴스를 배치하고 데이터 저장소를 작성하려면 다음 단계를 완료하십시오.
postgresql자원을 작성하십시오.kubectl apply -f postgres.yaml --namespace=instana-postgresCNPG 연산자를 사용한 경우 다음 단계를 수행하십시오:
앞서 생성한 비밀번호를 파일에
config.yaml저장하세요.datastoreConfigs: ... postgresConfigs: - user: instanaadmin password: <USER_GENERATED_PASSWORD> adminUser: instanaadmin adminPassword: <USER_GENERATED_PASSWORD> ...
Zalando 연산자를 사용한 경우 다음 단계를 수행하십시오:
Zalando 사용자의 자동 생성된 비밀번호를 조회합니다. 기본적으로 Zalando 는 무작위로 생성된 비밀번호를 가진 사용자를
postgres생성합니다.kubectl get secret postgres.postgres.credentials.postgresql.acid.zalan.do -n instana-postgres --template='{{index .data.password | base64decode}}' && echo검색된 비밀번호를
config.yaml파일에 저장하십시오.- ` < RETRIEVED_FROM_SECRET > 변수값을 이전 단계에서 얻은 비밀번호로 바꾸십시오.
- Zalando 의 사용자 이름으로 를
<username in the Postgres data store>대체하십시오.
datastoreConfigs: ... postgresConfigs: - user: <username in the Postgres data store> password: <RETRIEVED_FROM_SECRET> adminUser: <username in the Postgres data store> adminPassword: <RETRIEVED_FROM_SECRET> ...
Postgres 운영자 배포를 확인합니다.
kubectl get all -n instana-postgresPostgres 연산자가 성공적으로 배포되면 명령의 결과는 다음과 같습니다:
다음은 ` Zalando ` 연산자의 예시입니다:
NAME READY STATUS RESTARTS AGE pod/postgres-0 1/1 Running 0 100s pod/postgres-1 1/1 Running 0 69s pod/postgres-2 1/1 Running 0 41s pod/postgres-operator-766455c58c-ntmpf 1/1 Running 0 11m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/postgres ClusterIP 192.168.1.107 <none> 5432/TCP 101s service/postgres-operator ClusterIP 192.168.1.35 <none> 8080/TCP 11m service/postgres-repl ClusterIP 192.168.1.72 <none> 5432/TCP 101s NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/postgres-operator 1/1 1 1 11m NAME DESIRED CURRENT READY AGE replicaset.apps/postgres-operator-766455c58c 1 1 1 11m NAME READY AGE statefulset.apps/postgres 3/3 103s NAME IMAGE CLUSTER-LABEL SERVICE-ACCOUNT MIN-INSTANCES AGE operatorconfiguration.acid.zalan.do/postgres-operator ghcr.io/zalando/spilo-15:3.0-p1 cluster-name postgres-pod -1 11m NAME TEAM VERSION PODS VOLUME CPU-REQUEST MEMORY-REQUEST AGE STATUS postgresql.acid.zalan.do/postgres instana 15 3 10Gi 500m 2Gi 106s Running다음 출력은 다음에 대한 예입니다.CloudNativePG 운영자:
NAME READY STATUS RESTARTS AGE pod/postgres-1 1/1 Running 0 100s pod/postgres-2 1/1 Running 0 69s pod/postgres-3 1/1 Running 0 41s pod/cnpg-cloudnative-pg-64bbc87958-fqnrl 1/1 Running 0 11m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT service/cnpg-webhook-service ClusterIP 172.30.66.183 <none> 443/TCP service/postgres-r ClusterIP 172.30.163.146 <none> 5432/TCP service/postgres-ro ClusterIP 172.30.226.75 <none> 5432/TCP service/postgres-rw ClusterIP 172.30.235.178 <none> 5432/TCP NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/cnpg-cloudnative-p 1/1 1 1 11m NAME DESIRED CURRENT READY AGE replicaset.apps/cnpg-cloudnative-pg-64bbc87958 1 1 1 11m
Zalando 에서 CloudNativePG 으로 데이터 마이그레이션
부트스트랩 pg_basebackup 모드를 사용하면 기존 PostgreSQL 인스턴스(소스)의 물리적 상태를 정확히 복제하는 새로운 PostgreSQL 클러스터(대상)를 생성할 수 있습니다.
유효한 스트리밍 복제 연결을 통해 가동 중인 클러스터에서 부트스트랩할 수 있으며, 소스 PostgreSQL 인스턴스를 주(primary) 또는 대기(standby) PostgreSQL 서버로 사용할 수 있습니다.
클러스터의 ZalandoPostgreSQL 데이터를 부트스트랩 pg_basebackup 모드를 통해 복제 CloudNativePG 클러스터로 마이그레이션하려면 다음을 참조하십시오 데이터를 에서 Zalando 로 마이그레이션 CloudNativePG.