Back to blog

CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ ๊ตฌ์ถ• ๊ฐ€์ด๋“œ: Barman Cloud์™€ AWS S3 ๋ฐฑ์—…ยทWAL ์•„์นด์ด๋น™

August 05, 2026

์ž‘์„ฑ์ž: Swapnil Suryawanshi

๊ฒŒ์‹œ์ผ: 2026๋…„ 4์›” 15์ผ

์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๊ตฌ์ถ•ํ•˜๊ณ  ๋ฐฑ์—… ๋ฐ WAL ์•„์นด์ด๋น™์„ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋‹จ๊ณ„๋ณ„๋กœ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค. Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ AWS S3๋ฅผ ํ™œ์šฉํ•ด EDB Postgresยฎ AI for CloudNativePG ํ™˜๊ฒฝ์—์„œ ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋ฐฑ์—…ํ•˜๊ณ , ํ•ด๋‹น ๋ฐฑ์—…์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๊ตฌ์„ฑํ•œ ๋’ค ์‹ค์ œ ๋ฐ์ดํ„ฐ ๋ณต์ œ ์ƒํƒœ๊นŒ์ง€ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

ํ™˜๊ฒฝ ์„ธ๋ถ€ ์ •๋ณด

  • ์˜คํผ๋ ˆ์ดํ„ฐ(Operator): EDB Postgresยฎ AI for CloudNativePG 1.28.1
  • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค(Database): EDB Postgres Advanced Server 18 (EPAS)
  • ๋ฐฑ์—… ์„ค์ •(Backup Setup): Barman Cloud Plugin v0.11.0
  • ์Šคํ† ๋ฆฌ์ง€(Storage): AWS S3

1. ์‚ฌ์ „ ์š”๊ตฌ ์‚ฌํ•ญ: ๋„ค์ž„์ŠคํŽ˜์ด์Šค ๋ฐ ์ž๊ฒฉ ์ฆ๋ช… ์ƒ์„ฑ

๋จผ์ € ํ”„๋ผ์ด๋จธ๋ฆฌ(Primary) ๋ฐ ๋ ˆํ”Œ๋ฆฌ์นด(Replica) ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์œ„ํ•œ ๋ณ„๋„์˜ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ , Barman ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์˜ค๋ธŒ์ ํŠธ ์Šคํ† ์–ด์— ์•ก์„ธ์Šคํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ S3 ์ž๊ฒฉ ์ฆ๋ช…์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl create ns primary
namespace/primary created

user% kubectl create ns replica
namespace/replica created

ํ”„๋ผ์ด๋จธ๋ฆฌ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ๋™์ผํ•œ AWS ์ž๊ฒฉ ์ฆ๋ช…์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl create secret generic aws-creds \
--from-literal=ACCESS_KEY_ID=xxxxxxxxN3GE5FSxxxxxx \
--from-literal=ACCESS_SECRET_KEY=xxxxxxxxGrS+xlfTlCZTaTxxxxxx -n primary
secret/aws-creds created

๋ ˆํ”Œ๋ฆฌ์นด ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ๋™์ผํ•œ AWS ์ž๊ฒฉ ์ฆ๋ช…์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl create secret generic aws-creds \
--from-literal=ACCESS_KEY_ID=xxxxxxxxN3GE5FSxxxxxx \
--from-literal=ACCESS_SECRET_KEY=xxxxxxxxGrS+xlfTlCZTaTxxxxxx -n replica
secret/aws-creds created

2. Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์ •

Barman ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์•ˆ์ „ํ•œ ํ†ต์‹ ์„ ์œ„ํ•ด cert-manager๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. cmctl ์„ค์น˜๋ฅผ ํ™•์ธํ•˜๊ณ  cert-manager๋ฅผ ์„ค์น˜ํ•œ ํ›„ Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.

Bash

user% brew install cmctl
==> Auto-updating Homebrew...
Adjust how often this is run with `$HOMEBREW_AUTO_UPDATE_SECS` or disable with
`$HOMEBREW_NO_AUTO_UPDATE=1`. Hide these hints with `$HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
:
:notchi: Notch companion for Claude Code
nvidia-sync: Utility for launching applications and containers on remote Linux systems
You have 30 outdated formulae and 1 outdated cask installed.
installed 

Bash

user% kubectl create namespace cert-manager
namespace/cert-manager created

user%  kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml

Warning: resource namespaces/cert-manager is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
namespace/cert-manager configured
customresourcedefinition.apiextensions.k8s.io/challenges.acme.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/orders.acme.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/certificaterequests.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/certificates.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/clusterissuers.cert-manager.io unchanged
customresourcedefinition.apiextensions.k8s.io/issuers.cert-manager.io unchanged
serviceaccount/cert-manager-cainjector created
serviceaccount/cert-manager created
serviceaccount/cert-manager-webhook created
clusterrole.rbac.authorization.k8s.io/cert-manager-cainjector created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-issuers created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-clusterissuers created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-certificates created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-orders created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-challenges created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-ingress-shim created
clusterrole.rbac.authorization.k8s.io/cert-manager-cluster-view created
clusterrole.rbac.authorization.k8s.io/cert-manager-view created
clusterrole.rbac.authorization.k8s.io/cert-manager-edit created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-approve:cert-manager-io created
clusterrole.rbac.authorization.k8s.io/cert-manager-controller-certificatesigningrequests created
clusterrole.rbac.authorization.k8s.io/cert-manager-webhook:subjectaccessreviews created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-cainjector created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-issuers created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-clusterissuers created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-certificates created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-orders created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-challenges created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-ingress-shim created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-approve:cert-manager-io created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-controller-certificatesigningrequests created
clusterrolebinding.rbac.authorization.k8s.io/cert-manager-webhook:subjectaccessreviews created
role.rbac.authorization.k8s.io/cert-manager-cainjector:leaderelection created
role.rbac.authorization.k8s.io/cert-manager:leaderelection created
role.rbac.authorization.k8s.io/cert-manager-tokenrequest created
role.rbac.authorization.k8s.io/cert-manager-webhook:dynamic-serving created
rolebinding.rbac.authorization.k8s.io/cert-manager-cainjector:leaderelection created
rolebinding.rbac.authorization.k8s.io/cert-manager:leaderelection created
rolebinding.rbac.authorization.k8s.io/cert-manager-tokenrequest created
rolebinding.rbac.authorization.k8s.io/cert-manager-webhook:dynamic-serving created
service/cert-manager-cainjector created
service/cert-manager created
service/cert-manager-webhook created
deployment.apps/cert-manager-cainjector created
deployment.apps/cert-manager created
deployment.apps/cert-manager-webhook created
mutatingwebhookconfiguration.admissionregistration.k8s.io/cert-manager-webhook created
validatingwebhookconfiguration.admissionregistration.k8s.io/cert-manager-webhook created

Bash

user% kubectl get pods -n cert-manager
NAME                                       READY   STATUS    RESTARTS      AGE
cert-manager-6bfcb455c7-q75dr              1/1     Running   1 (37m ago)   107m
cert-manager-cainjector-84d45cd8f4-j4zvg   1/1     Running   0             107m
cert-manager-webhook-5bb447875c-lsn7s      1/1     Running   0             107m

user% cmctl check api                                                                             The cer
t-manager API is ready

์˜คํผ๋ ˆ์ดํ„ฐ์˜ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ํ”Œ๋Ÿฌ๊ทธ์ธ ๋งค๋‹ˆํŽ˜์ŠคํŠธ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl apply -f https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.11.0/manifest.yaml

customresourcedefinition.apiextensions.k8s.io/objectstores.barmancloud.cnpg.io created
serviceaccount/plugin-barman-cloud created
role.rbac.authorization.k8s.io/barman-plugin-leader-election-role created
clusterrole.rbac.authorization.k8s.io/barman-plugin-metrics-auth-role created
clusterrole.rbac.authorization.k8s.io/barman-plugin-metrics-reader created
clusterrole.rbac.authorization.k8s.io/barman-plugin-objectstore-editor-role created
clusterrole.rbac.authorization.k8s.io/barman-plugin-objectstore-viewer-role created
clusterrole.rbac.authorization.k8s.io/plugin-barman-cloud created
rolebinding.rbac.authorization.k8s.io/barman-plugin-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/barman-plugin-metrics-auth-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/plugin-barman-cloud-binding created
secret/plugin-barman-cloud-52ggkcd52d created
service/barman-cloud created
deployment.apps/barman-cloud created
certificate.cert-manager.io/barman-cloud-client created
certificate.cert-manager.io/barman-cloud-server created
issuer.cert-manager.io/selfsigned-issuer created

user% kubectl rollout status deployment -n postgresql-operator-system barman-cloud
deployment "barman-cloud" successfully rolled out

3. ObjectStore ๋ฆฌ์†Œ์Šค ์ƒ์„ฑ

๋‘ ๋„ค์ž„์ŠคํŽ˜์ด์Šค ๋ชจ๋‘์— ObjectStore ๋ฆฌ์†Œ์Šค๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์—๊ฒŒ ๋ฐฑ์—… ๋ฐ WAL ํŒŒ์ผ์„ ์ €์žฅํ•˜๊ณ  ๊ฒ€์ƒ‰ํ•  ์œ„์น˜๋ฅผ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.

ํ”„๋ผ์ด๋จธ๋ฆฌ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ์šฉ ObjectStore๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

YAML

user% vi ObjectStore-primary.yaml

apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
 name: s3-store
 namespace: primary # Also apply a copy to the 'replica' namespace
spec:
 configuration:
   destinationPath: s3://swapnil-backup/cnp/
   s3Credentials:
     accessKeyId:
       name: aws-creds
       key: ACCESS_KEY_ID
     secretAccessKey:
       name: aws-creds
       key: ACCESS_SECRET_KEY
   wal:
     compression: gzip

Bash

user% kubectl apply -f ObjectStore-primary.yaml
objectstore.barmancloud.cnpg.io/s3-store created

๋ ˆํ”Œ๋ฆฌ์นด ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ๋ ˆํ”Œ๋ฆฌ์นด ํด๋Ÿฌ์Šคํ„ฐ์šฉ ObjectStore๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

YAML

user% vi ObjectStore-replica.yaml

apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
 name: s3-store
 namespace: replica 
spec:
 configuration:
   destinationPath: s3://swapnil-backup/cnp/
   s3Credentials:
     accessKeyId:
       name: aws-creds
       key: ACCESS_KEY_ID
     secretAccessKey:
       name: aws-creds
       key: ACCESS_SECRET_KEY
   wal:
     compression: gzip

Bash

user% kubectl apply -f ObjectStore-replica.yaml
objectstore.barmancloud.cnpg.io/s3-store created     

4. ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ ๋ฐฐํฌ ๋ฐ WAL ์•„์นด์ด๋น™ ๊ฒ€์ฆ

ํ”„๋ผ์ด๋จธ๋ฆฌ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋ฐฐํฌํ•˜๊ณ  Barman ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ†ตํ•ด WAL ์•„์นด์ด๋น™ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

YAML

user% vi cluster-primary.yaml

apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
 name: cluster-primary
 namespace: primary
spec:
 instances: 3
 imageName: docker.enterprisedb.com/k8s/edb-postgres-advanced:18-standard-ubi9
 primaryUpdateStrategy: unsupervised
 storage:
   size: 1G
 replica:
   primary: cluster-primary
   source: cluster-primary
 plugins:
 - name: barman-cloud.cloudnative-pg.io
   isWALArchiver: true
   parameters:
     barmanObjectName: s3-store
 externalClusters:
 - name: cluster-primary
   plugin:
     name: barman-cloud.cloudnative-pg.io
     parameters:
       barmanObjectName: s3-store
       serverName: cluster-primary
 - name: cluster-replica
   plugin:
     name: barman-cloud.cloudnative-pg.io
     parameters:
       barmanObjectName: s3-store
       serverName: cluster-replica

Bash

user% kubectl apply -f cluster-primary.yaml
cluster.postgresql.k8s.enterprisedb.io/cluster-primary created

user% kubectl get pods -L role -n primary   
NAME                READY   STATUS    RESTARTS   AGE     ROLE
cluster-primary-1   2/2     Running   0          3m11s   primary
cluster-primary-2   2/2     Running   0          2m10s   replica
cluster-primary-3   2/2     Running   0          102s    replica

CNP ํด๋Ÿฌ์Šคํ„ฐ ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜๊ณ  WAL ์•„์นด์ด๋น™์ด โ€œOKโ€ ์ƒํƒœ์ธ์ง€ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl cnp status cluster-primary -n primary
Cluster Summary
Name                     primary/cluster-primary
System ID:                7621517035557347356
PostgreSQL Image:         docker.enterprisedb.com/k8s/edb-postgres-advanced:18-standard-ubi9
Primary instance:        cluster-primary-1
Primary promotion time:  2026-03-26 10:59:23 +0000 UTC (3m8s)
Status:                  Cluster in healthy state 
Instances:                3
Ready instances:          3
Size:                    169M
Current Write LSN:       0/8000060 (Timeline: 1 - WAL File: 000000010000000000000008)

Continuous Backup status (Barman Cloud Plugin)
No recovery window information found in ObjectStore 's3-store' for server 'cluster-primary'
Working WAL archiving:    OK
WALs waiting to be archived:  0
Last Archived WAL:            000000010000000000000007.00000028.backup   @   2026-03-26T11:00:11.577402Z
Last Failed WAL:              -

Streaming Replication status
Replication Slots Enabled
Name                Sent LSN   Write LSN  Flush LSN  Replay LSN  Write Lag  Flush Lag  Replay Lag  State      Sync State  Sync Priority  Replication Slot
----                --------   ---------  ---------  ----------  ---------  ---------  ----------  -----      ----------  -------------  ----------------
cluster-primary-2  0/8000060  0/8000060  0/8000060  0/8000060   00:00:00   00:00:00   00:00:00    streaming  async       0              active
cluster-primary-3  0/8000060  0/8000060  0/8000060  0/8000060   00:00:00   00:00:00   00:00:00    streaming  async       0              active

Instances status
Name                Current LSN  Replication role  Status  QoS          Manager Version  Node
----                -----------  ----------------  ------  ---          ---------------  ----
cluster-primary-1  0/8000060    Primary            OK      BestEffort  1.28.1           replicacluster-control-plane
cluster-primary-2  0/8000060    Standby (async)    OK      BestEffort  1.28.1           replicacluster-control-plane
cluster-primary-3  0/8000060    Standby (async)    OK      BestEffort  1.28.1           replicacluster-control-plane

Plugins status
Name                            Version  Status  Reported Operator Capabilities
----                            -------  ------  ------------------------------
barman-cloud.cloudnative-pg.io  0.11.0   N/A      Reconciler Hooks, Lifecycle Service

5. Barman Cloud๋ฅผ ์ด์šฉํ•œ ์ˆ˜๋™ ๋ฐฑ์—… ์‹คํ–‰

๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ ๋ถ€ํŠธ์ŠคํŠธ๋žฉ์„ ์œ„ํ•ด S3 ์˜ค๋ธŒ์ ํŠธ ์Šคํ† ์–ด์— ๋ฐ์ดํ„ฐ๊ฐ€ ์ฑ„์›Œ์ง€๋„๋ก Barman ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ†ตํ•ด ์ˆ˜๋™ ๋ฐฑ์—…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฑ์—…์„ ํŠธ๋ฆฌ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl cnp backup cluster-primary --method=plugin --plugin-name=barman-cloud.cloudnative-pg.io -n primary
backup/cluster-primary-20260326163523 created

๋ฐฑ์—… ์™„๋ฃŒ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl get backup -n primary   
NAME                            AGE   CLUSTER           METHOD   PHASE       ERROR
cluster-primary-20260326163523  33s   cluster-primary   plugin   completed   

๋ณต๊ตฌ ๊ฐ€๋Šฅํ•œ ์ฒซ ๋ฒˆ์งธ ์ง€์ (First Point of Recoverability)๊ณผ ๋งˆ์ง€๋ง‰ ์„ฑ๊ณต ๋ฐฑ์—…์„ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl cnp status cluster-primary -n primary                                                                     
Cluster Summary
Name                     primary/cluster-primary
System ID:                7621517035557347356
PostgreSQL Image:         docker.enterprisedb.com/k8s/edb-postgres-advanced:18-standard-ubi9
Primary instance:        cluster-primary-1
Primary promotion time:  2026-03-26 10:59:23 +0000 UTC (7m27s)
Status:                  Cluster in healthy state 
:
:
Continuous Backup status (Barman Cloud Plugin)
ObjectStore / Server name:      s3-store/cluster-primary
First Point of Recoverability:  2026-03-26 16:35:25 IST
Last Successful Backup:          2026-03-26 16:35:25 IST
Last Failed Backup:              -
Working WAL archiving:          OK
WALs waiting to be archived:    0
Last Archived WAL:              000000010000000000000008   @   2026-03-26T11:05:08.855493Z
Last Failed WAL:                -

6. CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ ๋ฐฐํฌ ๋ฐ ๊ฒ€์ฆ

๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋Š” ํ”„๋ผ์ด๋จธ๋ฆฌ์˜ ์˜ค๋ธŒ์ ํŠธ ์Šคํ† ์–ด์—์„œ ๋ณต๊ตฌ(Recovery)๋ฅผ ํ†ตํ•ด ๋ถ€ํŠธ์ŠคํŠธ๋žฉ๋˜๋„๋ก ๊ตฌ์„ฑ๋œ ํ›„ ๋™๊ธฐํ™”๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค. ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋Š” ๋ณต๊ตฌ๋ฅผ ์œ„ํ•ด cluster-primary ์†Œ์Šค๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค.

YAML

user% vi cluster-replica.yaml

apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
 name: cluster-replica
 namespace: replica
spec:
 instances: 3
 imageName: docker.enterprisedb.com/k8s/edb-postgres-advanced:18-standard-ubi9
 storage:
   size: 1G
 bootstrap:
   recovery:
     source: cluster-primary
 replica:
   primary: cluster-primary
   source: cluster-primary
 plugins:
 - name: barman-cloud.cloudnative-pg.io
   isWALArchiver: true
   parameters:
     barmanObjectName: s3-store
 externalClusters:
   - name: cluster-primary
     plugin:
       name: barman-cloud.cloudnative-pg.io
       parameters:
         barmanObjectName: s3-store   
         serverName: cluster-primary  
   - name: cluster-replica
     plugin:
       name: barman-cloud.cloudnative-pg.io
       parameters:
         barmanObjectName: s3-store
         serverName: cluster-replica

Bash

user% kubectl apply -f cluster-replica.yaml
cluster.postgresql.k8s.enterprisedb.io/cluster-replica created

user% kubectl get pods -L role -n replica  
 
NAME                READY   STATUS    RESTARTS   AGE    ROLE
cluster-replica-1   2/2     Running   0          116s   primary
cluster-replica-2   2/2     Running   0          88s    replica
cluster-replica-3   2/2     Running   0          60s    replica

๋ณต์ œ ์ƒํƒœ์™€ ์†Œ์Šค ํด๋Ÿฌ์Šคํ„ฐ ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

Bash

user% kubectl cnp status cluster-replica -n replica

Replica Cluster Summary
Name                      replica/cluster-replica
System ID:                7621517035557347356
PostgreSQL Image:         docker.enterprisedb.com/k8s/edb-postgres-advanced:18-standard-ubi9
Designated primary:       cluster-replica-1
Source cluster:           cluster-primary
Primary promotion time:  2026-03-26 11:08:43 +0000 UTC (2m8s)
Status:                  Cluster in healthy state 
Instances:                3
Ready instances:          3
Size:                    88M

Continuous Backup status (Barman Cloud Plugin)
No recovery window information found in ObjectStore 's3-store' for server 'cluster-replica'
Working WAL archiving:        OK
WALs waiting to be archived:  0
Last Archived WAL:            000000010000000000000008   @   2026-03-26T11:08:49.722535Z
Last Failed WAL:              -

Instances status
Name                Current LSN  Replication role              Status  QoS          Manager Version  Node
----                -----------  ----------------              ------  ---          ---------------  ----
cluster-replica-1  0/9000000    Designated primary            OK      BestEffort  1.28.1           replicacluster-control-plane
cluster-replica-2  0/9000000    Standby (in Replica Cluster)  OK      BestEffort  1.28.1           replicacluster-control-plane
cluster-replica-3  0/9000000    Standby (in Replica Cluster)  OK      BestEffort  1.28.1           replicacluster-control-plane

Plugins status
Name                            Version  Status  Reported Operator Capabilities
----                            -------  ------  ------------------------------
barman-cloud.cloudnative-pg.io  0.11.0   N/A      Reconciler Hooks, Lifecycle Service

7. PostgreSQL ๋ฐ์ดํ„ฐ ๋ณต์ œ ๊ฒ€์ฆ

ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋กœ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋ณต์ œ๋˜๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

ํ”„๋ผ์ด๋จธ๋ฆฌ ์ฝ๊ธฐ/์“ฐ๊ธฐ ํ…Œ์ŠคํŠธ

Bash

user% kubectl cnp psql cluster-primary -n primary
psql (18.3.0)
Type "help" for help.

postgres=# create table test(id int);
CREATE TABLE
postgres=# 
postgres=# insert into test values (1);
INSERT 0 1
postgres=# select * from test;
id 
----
 1
(1 row)

postgres=# checkpoint;
CHECKPOINT
postgres=# select * from pg_switch_wal();
pg_switch_wal 
---------------
0/9020208
(1 row)
postgres=# select * from pg_switch_wal();
pg_switch_wal 
---------------
0/A000078
(1 row)

๋ ˆํ”Œ๋ฆฌ์นด ์ฝ๊ธฐ ํ…Œ์ŠคํŠธ

Bash

user% kubectl cnp psql cluster-replica -n replica
psql (18.3.0)
Type "help" for help.

postgres=# \dt
         List of relations
Schema | Name | Type  |  Owner   
--------+------+-------+----------
public | test | table | postgres
(1 row)

postgres=# \dt
         List of relations
Schema | Name | Type  |  Owner   
--------+------+-------+----------
public | test | table | postgres
(1 row)

postgres=# select * from test; 
id 
----
 1
(1 row)

๊ฒฐ๋ก 

primary ๋„ค์ž„์ŠคํŽ˜์ด์Šค์˜ cluster-primary์—์„œ ๋ถ€ํŠธ์ŠคํŠธ๋žฉ๋˜์–ด replica ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— cluster-replica๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ฐฐํฌํ•œ ๊ฒƒ์€ CloudNativePG ํ™˜๊ฒฝ ๋‚ด์—์„œ Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ๋›ฐ์–ด๋‚œ ๊ฒฌ๊ณ ์„ฑ์„ ์ž…์ฆํ•ฉ๋‹ˆ๋‹ค.

์ „์ฒด ๋ฐ”์ด๋„ˆ๋ฆฌ ๋ฐฑ์—…๊ณผ ์ง€์†์ ์ธ WAL ์•„์นด์ด๋น™์„ ์œ„ํ•ด S3 ํ˜ธํ™˜ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ํ™œ์šฉํ•จ์œผ๋กœ์จ, ์ดˆ๊ธฐ ๋‹จ๊ณ„ ๋™์•ˆ ํ”„๋ผ์ด๋จธ๋ฆฌ์˜ ํ™œ์„ฑ ํฌ๋“œ์— ์ง์ ‘์ ์ธ ๋„คํŠธ์›Œํฌ ์ข…์†์„ฑ ์—†์ด ๋ ˆํ”Œ๋ฆฌ์นด ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ๋™๊ธฐํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ๋ถ„๋ฆฌ๋œ ์•„ํ‚คํ…์ฒ˜(Decoupled Architecture)๋ฅผ ๋‹ฌ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ณ ๊ธ‰ ์šด์˜: ๋ผ์ดํ”„์‚ฌ์ดํด ๊ด€๋ฆฌ

์ด์ œ ๋ถ„์‚ฐ ํ† ํด๋กœ์ง€๊ฐ€ ์„ค์ •๋˜๊ณ  Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๊ฐ€ ๋™๊ธฐํ™”๋˜๋ฏ€๋กœ ํด๋Ÿฌ์Šคํ„ฐ ๊ฐ„์˜ ํŠธ๋ž˜ํ”ฝ์„ ์ˆ˜๋™ ๋˜๋Š” ์ž๋™์œผ๋กœ ์ „ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ๋‹จ๊ณ„: ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ํ”„๋ผ์ด๋จธ๋ฆฌ ์ƒํƒœ๋กœ ์Šน๊ฒฉ์‹œํ‚ค๊ณ  ๋ฐ์ดํ„ฐ ์†์‹ค ์—†์ด ๊ธฐ์กด ํ”„๋ผ์ด๋จธ๋ฆฌ๋ฅผ ๊ฐ•๋“ฑ์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์€ ๋Ÿฐ๋ถ [๋ถ„์‚ฐ ํ† ํด๋กœ์ง€(K8s)์—์„œ CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ์˜ ์Šค์œ„์น˜์˜ค๋ฒ„ ๋ฐ ์Šค์œ„์น˜๋ฐฑ โ€“ 2๋ถ€]๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.


CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ FAQ

CloudNativePG ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋Š” ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑํ•˜๋‚˜์š”?

์ด ๊ตฌ์„ฑ์—์„œ๋Š” ํ”„๋ผ์ด๋จธ๋ฆฌ์™€ ๋ ˆํ”Œ๋ฆฌ์นด์— ๊ฐ๊ฐ ๋ณ„๋„์˜ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ  Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ ObjectStore๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ดํ›„ ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ์˜ S3 ๋ฐฑ์—…์„ ๊ธฐ๋ฐ˜์œผ๋กœ cluster-replica๋ฅผ ๋ณต๊ตฌ ๋ฐฉ์‹์œผ๋กœ ๋ถ€ํŠธ์ŠคํŠธ๋žฉํ•ด ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ์€ CloudNativePG์—์„œ ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋‚˜์š”?

์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” Barman Cloud ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ”„๋ผ์ด๋จธ๋ฆฌ ๋ฐ ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ์˜ ๋ฐฑ์—…๊ณผ WAL ์•„์นด์ด๋น™์— ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ObjectStore ๋ฆฌ์†Œ์Šค๋ฅผ ํ†ตํ•ด ๋ฐฑ์—…๊ณผ WAL ํŒŒ์ผ์„ ์ €์žฅํ•˜๊ณ  ๊ฒ€์ƒ‰ํ•  S3 ์œ„์น˜๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

CloudNativePG ๋ฐฑ์—…์„ AWS S3์— ์ €์žฅํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

์˜ˆ. ์ด ๊ตฌ์„ฑ์—์„œ๋Š” ObjectStore์˜ destinationPath์— AWS S3 ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•˜๊ณ  S3 ์ž๊ฒฉ ์ฆ๋ช…์„ ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ์˜ ์ˆ˜๋™ ๋ฐฑ์—…๊ณผ WAL ํŒŒ์ผ์€ ์„ค์ •๋œ ์˜ค๋ธŒ์ ํŠธ ์Šคํ† ์–ด๋ฅผ ํ†ตํ•ด ๊ด€๋ฆฌ๋ฉ๋‹ˆ๋‹ค.

PostgreSQL WAL ์•„์นด์ด๋น™ ์ƒํƒœ๋Š” ์–ด๋–ป๊ฒŒ ํ™•์ธํ•˜๋‚˜์š”?

kubectl cnp status ๋ช…๋ น์œผ๋กœ ํด๋Ÿฌ์Šคํ„ฐ ์ƒํƒœ๋ฅผ ์กฐํšŒํ•˜๋ฉด Barman Cloud Plugin์˜ Continuous Backup ์ƒํƒœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” Working WAL archiving: OK์™€ ๋Œ€๊ธฐ ์ค‘์ธ WAL ์ˆ˜, ๋งˆ์ง€๋ง‰์œผ๋กœ ์•„์นด์ด๋น™๋œ WAL์„ ํ™•์ธํ•ด ์ •์ƒ ๋™์ž‘ ์—ฌ๋ถ€๋ฅผ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

Barman Cloud ๋ฐฑ์—…์œผ๋กœ ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ๋ถ€ํŠธ์ŠคํŠธ๋žฉํ•˜๋‚˜์š”?

๋จผ์ € ํ”„๋ผ์ด๋จธ๋ฆฌ ํด๋Ÿฌ์Šคํ„ฐ์˜ ๋ฐฑ์—…์„ ์™„๋ฃŒํ•œ ๋’ค ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ ์„ค์ •์˜ bootstrap.recovery.source์— cluster-primary๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ดํ›„ ๋ณต์ œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋ฐฐํฌํ•˜๊ณ  kubectl cnp status ๋ฐ ์‹ค์ œ ์ฝ๊ธฐ ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•ด ์†Œ์Šค ํด๋Ÿฌ์Šคํ„ฐ์™€์˜ ๋ณต์ œ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.


๋ฉ”์ผ: salesinquiry@enterprisedb.com

Share this