Skip to content

Single node cluster becomes multi-node when config supplied #2222

@jamessewell

Description

@jamessewell
pgo client version 4.5.1
pgo-apiserver version 4.5.1

When I deploy a single node cluster with this command:

pgo create cluster  -n jirotech --cpu 4 --memory 124G  fgp-pg

Then all goes well.

When I try to supply custom config by creating a configmap from the following YAML:

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: fgp-pg-config
data:
  postgres-ha.yaml: |-
    ---
    bootstrap:
      dcs:
        postgresql:
          parameters:
              max_connections : 100
              shared_buffers : 32GB
              effective_cache_size : 96GB
              maintenance_work_mem : 2GB
              checkpoint_completion_target : 0.9
              wal_buffers : 16MB
              default_statistics_target : 100
              random_page_cost : 1.1
              effective_io_concurrency : 200
              work_mem : 167772kB
              min_wal_size : 1GB
              max_wal_size : 4GB
              max_worker_processes : 4
              max_parallel_workers_per_gather : 2
              max_parallel_workers : 4
              max_parallel_maintenance_workers : 2

Then doing:

pgo create cluster  -n jirotech --cpu 4 --memory 124G --custom-config pg-config jiro-pg

Then the cluster will never bootstrap because it can't get the leader lock, log snippet attached:

******************************
Patroni configuration file:
******************************
bootstrap:
  method: initdb
  pgbackrest_init:
    command: '/opt/cpm/bin/pgbackrest/pgbackrest-create-replica.sh primary'
    keep_existing_recovery_conf: true
  existing_init:
    command: '/opt/cpm/bin/bootstrap/create-from-existing.sh'
    keep_existing_recovery_conf: true
  dcs:
    postgresql:
      parameters:
        unix_socket_directories: /tmp,/crunchyadm
        wal_level: logical
        archive_mode: on
        archive_command: 'source /opt/cpm/bin/pgbackrest/pgbackrest-set-env.sh &&
          pgbackrest archive-push "%p"'
        archive_timeout: 60
        log_directory: pg_log
        shared_buffers: 128MB
        temp_buffers: 8MB
        log_min_duration_statement: 60000
        log_statement: none
        work_mem: 4MB
        max_wal_senders: 6
        shared_preload_libraries: pgaudit.so,pg_stat_statements.so,pgnodemx.so
      use_slots: false
      recovery_conf:
        restore_command: 'source /opt/cpm/bin/pgbackrest/pgbackrest-set-env.sh &&
          pgbackrest archive-get %f "%p"'
      use_pg_rewind: true
  post_bootstrap: /opt/cpm/bin/bootstrap/post-bootstrap.sh
  initdb:
  - encoding: UTF8
  - data-checksums
postgresql:
  use_unix_socket: true
  pgpass: /tmp/.pgpass
  create_replica_methods:
  - pgbackrest
  - basebackup
  pgbackrest:
    command: '/opt/cpm/bin/pgbackrest/pgbackrest-create-replica.sh replica'
    keep_data: true
    no_params: true
  pgbackrest_standby:
    command: '/opt/cpm/bin/pgbackrest/pgbackrest-create-replica.sh standby'
    keep_data: true
    no_params: true
    no_master: 1
  remove_data_directory_on_rewind_failure: true
  callbacks:
    on_role_change: /opt/cpm/bin/callbacks/pgha-on-role-change.sh
  pg_hba:
  - local all postgres peer
  - local all crunchyadm peer
  - host replication primaryuser 0.0.0.0/0 md5
  - host all primaryuser 0.0.0.0/0 reject
  - host all all 0.0.0.0/0 md5
Wed Jan 20 03:16:44 UTC 2021 INFO: Applying SSHD..
Wed Jan 20 03:16:44 UTC 2021 INFO: Checking for SSH Host Keys in /sshd..
Wed Jan 20 03:16:44 UTC 2021 INFO: Checking for authorized_keys in /sshd
Wed Jan 20 03:16:44 UTC 2021 INFO: Checking for sshd_config in /sshd
Wed Jan 20 03:16:44 UTC 2021 INFO: setting up .ssh directory
Wed Jan 20 03:16:44 UTC 2021 INFO: Starting SSHD..
Wed Jan 20 03:16:44 UTC 2021 INFO: Starting background process to monitor Patroni initization and restart the database if needed
Wed Jan 20 03:16:44 UTC 2021 INFO: Initializing cluster bootstrap with command: '/usr/local/bin/patroni /tmp/postgres-ha-bootstrap.yaml'
Wed Jan 20 03:16:44 UTC 2021 INFO: Running Patroni as PID 1
2021-01-20 03:16:45,111 INFO: No PostgreSQL configuration items changed, nothing to reload.
2021-01-20 03:16:45,114 INFO: Lock owner: None; I am fgp-pg-656cf4d698-wbf9m
2021-01-20 03:16:45,251 INFO: failed to acquire initialize lock
2021-01-20 03:16:55,615 INFO: Lock owner: None; I am fgp-pg-656cf4d698-wbf9m
2021-01-20 03:16:55,666 INFO: failed to acquire initialize lock

I have also tried with the configmap pointing at postgres.yaml rather than postgres-ha.yaml

Any hints?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions