Your message dated Thu, 24 Mar 2022 14:51:38 +0100
with message-id <[email protected]>
and subject line Re: Bug#916246: patroni doesnt bootstrap
has caused the Debian Bug report #916246,
regarding patroni doesnt bootstrap
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
916246: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916246
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: patroni
Version: 1.5.1-2
Severity: normal

Dear Maintainer,

I edited /etc/patroni/config.yml (copy appended), installed a 
brand new postgresql, ran patroni /etc/patroni/config.yml and see:
2018-12-12 11:40:43,456 INFO: Lock owner: None; I am test-db
2018-12-12 11:40:43,468 INFO: trying to bootstrap a new cluster
2018-12-12 11:40:43,471 INFO: Lock owner: None; I am test-db
2018-12-12 11:40:43,471 INFO: not healthy enough for leader race
2018-12-12 11:40:43,472 INFO: bootstrap in progress
2018-12-12 11:40:43,472 INFO: Running custom bootstrap script: 
/usr/share/patroni/pg_createcluster_patroni
Creating new PostgreSQL cluster 11/testdb ...
/usr/lib/postgresql/11/bin/initdb -D /var/lib/postgresql/11/testdb --auth-local 
peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_AU.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/11/testdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/11/bin/pg_ctl -D /var/lib/postgresql/11/testdb -l 
logfile start

Ver Cluster Port Status Owner    Data directory                Log file
11  testdb  5433 down   postgres /var/lib/postgresql/11/testdb 
/var/log/postgresql/postgresql-11-testdb.log
2018-12-12 11:40:44,816 INFO: postmaster pid=928
10.13.1.77:5432 - no response
2018-12-12 11:40:44,842 INFO: removing initialize key after failed attempt to 
bootstrap the cluster
2018-12-12 11:40:44,852 INFO: renaming data directory to 
/var/lib/postgresql/11/testdb_2018-12-12-11-40-44
2018-12-12 11:40:44,952 INFO: Lock owner: None; I am test-db
Traceback (most recent call last):
  File "/usr/bin/patroni", line 11, in <module>
    load_entry_point('patroni==1.5.1', 'console_scripts', 'patroni')()
  File "/usr/lib/python3/dist-packages/patroni/__init__.py", line 182, in main
    return patroni_main()
  File "/usr/lib/python3/dist-packages/patroni/__init__.py", line 149, in 
patroni_main
    patroni.run()
  File "/usr/lib/python3/dist-packages/patroni/__init__.py", line 114, in run
    logger.info(self.ha.run_cycle())
  File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1275, in run_cycle
    info = self._run_cycle()
  File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1183, in _run_cycle
    return self.post_bootstrap()
  File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1079, in 
post_bootstrap
    self.cancel_initialization()
  File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1074, in 
cancel_initialization
    raise PatroniException('Failed to bootstrap cluster')
patroni.exceptions.PatroniException: 'Failed to bootstrap cluster'

config.yml is:

scope: "11-testdb"
namespace: "/postgresql-common/"
name: test-db

#etcd:
#  host: 127.0.0.1:2379

consul:
  host: 127.0.0.1:8500
#  host: https://127.0.0.1:8500

#zookeeper:
#  hosts: 127.0.0.1:2181

restapi:
  listen: 10.13.1.77:8008
  connect_address: 10.13.1.77:8008
#  certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem
#  keyfile: /etc/ssl/private/ssl-cert-snakeoil.key
#  authentication:
#    username: username
#    password: password

# ctl:
#   insecure: false # Allow connections to SSL sites without certs
#   certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem
#   cacert: /etc/ssl/certs/ssl-cacert-snakeoil.pem

bootstrap:
  # Custom bootstrap method
  method: pg_createcluster
  pg_createcluster:
    command: /usr/share/patroni/pg_createcluster_patroni

  # this section will be written into Etcd:/<namespace>/<scope>/config after 
initializing new cluster
  # and all other cluster members will use it as a `global configuration`
  dcs:
    ttl: 30
    loop_wait: 10
    retry_timeout: 10
    maximum_lag_on_failover: 1048576
#    master_start_timeout: 300
#    synchronous_mode: false
#    standby_cluster:
#      host: 127.0.0.1
#      port: 1111
#      primary_slot_name: patroni
    postgresql:
      use_pg_rewind: true
      use_slots: true
      parameters:
        wal_level: hot_standby
        hot_standby: "on"
        wal_keep_segments: 8
        max_wal_senders: 10
        max_replication_slots: 10
        wal_log_hints: "on"
#        archive_mode: "on"
#        archive_timeout: 1800s
#        archive_command: mkdir -p ../wal_archive && test ! -f 
../wal_archive/%f && cp %p ../wal_archive/%f
#      recovery_conf:
#        restore_command: cp ../wal_archive/%f %p

  # some desired options for 'initdb'
  initdb:  # Note: It needs to be a list (some options need values, others are 
switches)
  - encoding: UTF8
  - data-checksums

  pg_hba:  # Add following lines to pg_hba.conf after running 'initdb'
  - host replication replicator 127.0.0.1/32 md5
  - host all all 0.0.0.0/0 md5
#  - hostssl all all 0.0.0.0/0 md5

postgresql:
  # Custom clone method
  create_replica_method:
    - pg_clonecluster
  pg_clonecluster:
    command: /usr/share/patroni/pg_clonecluster_patroni

  listen: 10.13.1.77:5432
  connect_address: 10.13.1.77:5432
  data_dir: /var/lib/postgresql/11/testdb
  bin_dir: /usr/lib/postgresql/11/bin
  config_dir: /etc/postgresql/11/testdb
  pgpass: /etc/patroni/pgpass
  authentication:
    replication:
      username: replicator
      password: rep-pass
#    superuser:
#      username: postgres
#      password: zalando
  parameters:
    unix_socket_directories: '/var/run/postgresql/'
    # Emulate default Debian/Ubuntu logging
    logging_collector: 'on'
    log_directory: '/var/log/postgresql'
    log_filename: 'postgresql-11-testdb.log'

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages patroni depends on:
ii  lsb-base             10.2018112800
ii  python3              3.6.7-1
ii  python3-cdiff        1.0-1
ii  python3-click        6.7+git20180829-1
ii  python3-consul       0.7.1-1
ii  python3-dateutil     2.6.1-1
ii  python3-etcd         0.4.5-1
ii  python3-prettytable  0.7.2-3
ii  python3-psutil       5.4.8-1
ii  python3-psycopg2     2.7.5-2
ii  python3-requests     2.20.0-2
ii  python3-six          1.11.0-2
ii  python3-tzlocal      1.5.1-1
ii  python3-urllib3      1.24-1
ii  python3-yaml         3.13-1

patroni recommends no packages.

Versions of packages patroni suggests:
ii  consul       1.0.7~dfsg1-5
pn  haproxy      <none>
ii  patroni-doc  1.5.1-2
ii  postgresql   11+197

-- no debconf information

--- End Message ---
--- Begin Message ---
Hi,

Am Montag, dem 14.01.2019 um 16:36 +0100 schrieb Michael Banck:
> Am Mittwoch, den 12.12.2018, 00:49 +0000 schrieb Peter Chubb:
> >   listen: 10.13.1.77:5432
> 
> You are putting port 5432 here, but this one is apparently already
> taken
> (likely by the default "main" cluster), see above.
> 
> Also, I think what could be another problem is that a
> "127.0.0.1:5432"
> is missing here; I seem to remember that patroni might need that for
> local monitoring.  However, testing now did not reveal any issues
> when I
> ommitted 127.0.0.1.
> 
> >   connect_address: 10.13.1.77:5432
> >   data_dir: /var/lib/postgresql/11/testdb
> >   bin_dir: /usr/lib/postgresql/11/bin
> >   config_dir: /etc/postgresql/11/testdb
> >   pgpass: /etc/patroni/pgpass
> >   authentication:
> >     replication:
> >       username: replicator
> >       password: rep-pass
> > #    superuser:
> > #      username: postgres
> > #      password: zalando
> 
> This `superuser:' stanza is actually required, if I omit it I get:
> 
> > 2019-01-14 15:19:56,552 ERROR: post_bootstrap
> > Traceback (most recent call last):
> >  File "/usr/lib/python3/dist-packages/patroni/postgresql.py", line
> > 1667, in post_bootstrap
> >    self.create_or_update_role(self._superuser['username'],
> > self._superuser['password'], ['SUPERUSER'])
> > KeyError: 'username'
> 
> I will add a comment to this end to the default config.yml.
> 
> Let me know if that helped or if you still have issues.

Closing this bug now. Let me know if this is still a problem and should
be reopened.


Michael

-- 
Michael Banck
Teamleiter PostgreSQL-Team
Projektleiter
Tel.: +49 2166 9901-171
E-Mail: [email protected]

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Geoff Richardson, Peter Lilley

Unser Umgang mit personenbezogenen Daten unterliegt
folgenden Bestimmungen: https://www.credativ.de/datenschutz

--- End Message ---

Reply via email to