Hi, sorry, this apparently fell through the pre-holiday cracks...
Am Mittwoch, den 12.12.2018, 00:49 +0000 schrieb Peter Chubb: > 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 Note that it is using port 5433 here ... > 2018-12-12 11:40:44,816 INFO: postmaster pid=928 > 10.13.1.77:5432 - no response ... but Patroni is trying to connect to 5432. [...] > 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_failove > r: 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 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. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: [email protected] credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen: https://www.credativ.de/datenschutz

