diff --git a/examples/eu/cluster-dc-eu.yaml b/examples/eu/pg-eu.yaml similarity index 54% rename from examples/eu/cluster-dc-eu.yaml rename to examples/eu/pg-eu.yaml index a8d48b1..a85f9c8 100644 --- a/examples/eu/cluster-dc-eu.yaml +++ b/examples/eu/pg-eu.yaml @@ -1,13 +1,18 @@ apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: - name: cluster-dc-eu + name: pg-eu spec: instances: 3 storage: size: 1Gi + # See https://cloudnative-pg.io/documentation/current/storage/#volume-for-wal + walStorage: + size: 1Gi + + # See https://cloudnative-pg.io/documentation/current/scheduling/#isolating-postgresql-workloads affinity: nodeSelector: node-role.kubernetes.io/postgres: "" @@ -19,6 +24,27 @@ spec: topologyKey: kubernetes.io/hostname podAntiAffinityType: required + # See https://cloudnative-pg.io/documentation/current/bootstrap/#bootstrap-an-empty-cluster-initdb + bootstrap: + initdb: + dataChecksums: true + + postgresql: + # See https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-postgresql-section + parameters: + # Some very basic Postgres settings + max_connections: '100' + log_checkpoints: 'on' + log_lock_waits: 'on' + pg_stat_statements.max: '10000' + pg_stat_statements.track: 'all' + hot_standby_feedback: 'on' + # Note: `remote_apply` slows down write operations + synchronous_commit: 'remote_apply' + # Container images work fine with sysv shared memory + shared_memory_type: 'sysv' + dynamic_shared_memory_type: 'sysv' + backup: barmanObjectStore: destinationPath: s3://backups/ @@ -33,15 +59,16 @@ spec: wal: compression: gzip + # See https://cloudnative-pg.io/documentation/current/replica_cluster/#distributed-topology replica: - self: cluster-dc-eu - primary: cluster-dc-eu - source: cluster-dc-us + self: pg-eu + primary: pg-eu + source: pg-us externalClusters: - - name: cluster-dc-eu + - name: pg-eu barmanObjectStore: - serverName: cluster-dc-eu + serverName: pg-eu destinationPath: s3://backups/ endpointURL: http://minio-eu:9000 s3Credentials: @@ -53,9 +80,9 @@ spec: key: ACCESS_SECRET_KEY wal: compression: gzip - - name: cluster-dc-us + - name: pg-us barmanObjectStore: - serverName: cluster-dc-us + serverName: pg-us destinationPath: s3://backups/ endpointURL: http://minio-us:9000 s3Credentials: @@ -68,13 +95,14 @@ spec: wal: compression: gzip --- +# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups apiVersion: postgresql.cnpg.io/v1 kind: ScheduledBackup metadata: - name: cluster-dc-eu-backup + name: pg-eu-backup spec: schedule: '0 0 0 * * *' backupOwnerReference: self cluster: - name: cluster-dc-eu + name: pg-eu immediate: true diff --git a/examples/us/cluster-dc-us.yaml b/examples/us/pg-us.yaml similarity index 55% rename from examples/us/cluster-dc-us.yaml rename to examples/us/pg-us.yaml index d24d73a..37711f6 100644 --- a/examples/us/cluster-dc-us.yaml +++ b/examples/us/pg-us.yaml @@ -1,13 +1,18 @@ apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: - name: cluster-dc-us + name: pg-us spec: instances: 3 storage: size: 1Gi + # See https://cloudnative-pg.io/documentation/current/storage/#volume-for-wal + walStorage: + size: 1Gi + + # See https://cloudnative-pg.io/documentation/current/scheduling/#isolating-postgresql-workloads affinity: nodeSelector: node-role.kubernetes.io/postgres: "" @@ -19,6 +24,27 @@ spec: topologyKey: kubernetes.io/hostname podAntiAffinityType: required + # See https://cloudnative-pg.io/documentation/current/recovery/ + bootstrap: + recovery: + source: pg-eu + + postgresql: + # See https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-postgresql-section + parameters: + # Some very basic Postgres settings + max_connections: '100' + log_checkpoints: 'on' + log_lock_waits: 'on' + pg_stat_statements.max: '10000' + pg_stat_statements.track: 'all' + hot_standby_feedback: 'on' + # Note: `remote_apply` slows down write operations + synchronous_commit: 'remote_apply' + # Container images work fine with sysv shared memory + shared_memory_type: 'sysv' + dynamic_shared_memory_type: 'sysv' + backup: barmanObjectStore: destinationPath: s3://backups/ @@ -33,19 +59,16 @@ spec: wal: compression: gzip - bootstrap: - recovery: - source: cluster-dc-eu - + # See https://cloudnative-pg.io/documentation/current/replica_cluster/#distributed-topology replica: - self: cluster-dc-us - primary: cluster-dc-eu - source: cluster-dc-eu + self: pg-us + primary: pg-eu + source: pg-eu externalClusters: - - name: cluster-dc-eu + - name: pg-eu barmanObjectStore: - serverName: cluster-dc-eu + serverName: pg-eu destinationPath: s3://backups/ endpointURL: http://minio-eu:9000 s3Credentials: @@ -57,9 +80,9 @@ spec: key: ACCESS_SECRET_KEY wal: compression: gzip - - name: cluster-dc-us + - name: pg-us barmanObjectStore: - serverName: cluster-dc-us + serverName: pg-us destinationPath: s3://backups/ endpointURL: http://minio-us:9000 s3Credentials: @@ -72,13 +95,14 @@ spec: wal: compression: gzip --- +# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups apiVersion: postgresql.cnpg.io/v1 kind: ScheduledBackup metadata: - name: cluster-dc-us-backup + name: pg-us-backup spec: schedule: '0 0 0 * * *' backupOwnerReference: self cluster: - name: cluster-dc-us + name: pg-us immediate: true