Header Shadow Image


patroni.exceptions.PatroniFatalException: ‘Can not find suitable configuration of distributed configuration store\nAvailable implementations: etcd, etcd3, kubernetes’

Getting this?

[root@psql06 ~]# systemctl status patroni
? patroni.service – Runners to orchestrate a high-availability PostgreSQL
   Loaded: loaded (/etc/systemd/system/patroni.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2022-03-03 01:28:53 EST; 9s ago
  Process: 10292 ExecStart=/usr/local/bin/patroni /etc/patroni.yml (code=exited, status=1/FAILURE)
 Main PID: 10292 (code=exited, status=1/FAILURE)

Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: File "/usr/local/lib/python3.6/site-packages/patroni/daemon.py", line 98, in abstract_main
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: controller = cls(config)
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: File "/usr/local/lib/python3.6/site-packages/patroni/__main__.py", line 25, in __init__
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: self.dcs = get_dcs(self.config)
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: File "/usr/local/lib/python3.6/site-packages/patroni/dcs/__init__.py", line 111, in get_dcs
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: Available implementations: """ + ', '.join(sorted(set(available_implementations))))
Mar 03 01:28:53 psql06.nix.mds.xyz patroni[10292]: patroni.exceptions.PatroniFatalException: 'Can not find suitable configuration of distributed configuration store\nAv…tes, raft'
Mar 03 01:28:53 psql06.nix.mds.xyz systemd[1]: patroni.service: main process exited, code=exited, status=1/FAILURE
Mar 03 01:28:53 psql06.nix.mds.xyz systemd[1]: Unit patroni.service entered failed state.
Mar 03 01:28:53 psql06.nix.mds.xyz systemd[1]: patroni.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@psql06 ~]#

More precisely:

Mar 03 01:18:39 psql06.nix.mds.xyz patroni[9867]: File "/usr/local/lib/python3.6/site-packages/patroni/dcs/__init__.py", line 111, in get_dcs
Mar 03 01:18:39 psql06.nix.mds.xyz patroni[9867]: Available implementations: """ + ', '.join(sorted(set(available_implementations))))
Mar 03 01:18:39 psql06.nix.mds.xyz patroni[9867]: patroni.exceptions.PatroniFatalException: 'Can not find suitable configuration of distributed configuration store\nAvailable implementations: etcd, etcd3, kubernetes'
Mar 03 01:18:39 psql06.nix.mds.xyz systemd[1]: patroni.service: main process exited, code=exited, status=1/FAILURE
Mar 03 01:18:39 psql06.nix.mds.xyz systemd[1]: Unit patroni.service entered failed state.
Mar 03 01:18:39 psql06.nix.mds.xyz systemd[1]: patroni.service failed.
^C
[root@psql06 ~]#

Reboot the machines?  Dependencies were installed but maybe did not take effect till a reboot?  Turns out the .yml file was not right.  When copying and pasting from documents, the formatting is often changed:

[root@psql06 ~]#
[root@psql06 ~]# python3 -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < /etc/patroni.yml
{'postgresql': {'data_dir': '/data/patroni', 'parameters': {'unix_socket_directories': '.', 'max_replication_slots': '64', 'max_connections': '256'}, 'pgpass': '/tmp/pgpass', 'unix_socket_directories': '/data/patroni', 'authentication': {'replication': {'username': 'replicator', 'password': 'rep-pass'}, 'superuser': {'username': 'postgres', 'password': 'secretpassword'}}, 'bin_dir': '/usr/pgsql-10/bin', 'connect_address': 'psql06.nix.mds.xyz:5432', 'listen': 'psql06.nix.mds.xyz:5432'}, 'name': 'postgresql2', 'tags': {'nofailover': False, 'noloadbalance': False, 'clonefrom': False, 'nosync': False}, 'restapi': {'connect_address': 'psql06.nix.mds.xyz:8008', 'listen': 'psql06.nix.mds.xyz:8008'}, 'bootstrap': {'pg_hba': [‘host replication replicator 127.0.0.1/32 md5’, ‘host replication replicator psql04.nix.mds.xyz/0 md5’, ‘host replication replicator psql05.nix.mds.xyz/0 md5’, ‘host replication replicator psql06.nix.mds.xyz/0 md5’, ‘host all all 0.0.0.0/0 md5’], ‘users’: {‘admin’: {‘password’: ‘admin’, ‘options’: [‘createrole’, ‘createdb’]}}, ‘initdb’: [{‘encoding’: ‘UTF8’}, ‘data-checksums’], 'dcs': {'ttl': 30, 'maximum_lag_on_failover': 1048576, 'retry_timeout': 10, 'postgresql': {'use_pg_rewind': True}, 'loop_wait': 10}}, 'namespace': '/db/', 'etcd': {'host': 'psql06.nix.mds.xyz:2379'}, 'scope': 'postgres', 'log': {'level': 'DEBUG', 'file_num': 37, 'dir': '/var/log/patroni/', 'file_size': 52428800}}
[root@psql06 ~]#

In comparison to the bad backup:

[root@psql06 ~]# python3 -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < /etc/patroni.yml-backup01
{u'\xa0 \xa0 \xa0 \xa0 maximum_lag_on_failover': 1048576, u'\xa0 \xa0 nosync': False, u'\xa0 \xa0 \xa0 \xa0 superuser': None, u'\xa0 \xa0 \xa0 \xa0 unix_socket_directories': '.', u'\xa0 \xa0 \xa0 \xa0 retry_timeout': 10, u'\xa0 \xa0 unix_socket_directories': '/data/patroni', u'\xa0 \xa0 \xa0 \xa0 ttl': 30, u'\xa0 \xa0 connect_address': '192.168.0.186:5432', u'\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 use_pg_rewind': True, 'log': {'level': 'DEBUG', 'file_num': 37, 'dir': '/var/log/patroni/', 'file_size': 52428800}, u'\xa0 \xa0 bin_dir': '/usr/pgsql-10/bin', u'\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 password': 'secretpassword', 'namespace': '/db/', u'\xa0 \xa0 authentication': None, u'\xa0 \xa0 nofailover': False, u'\xa0 \xa0 listen': '192.168.0.186:5432', 'etcd': None, 'restapi': None, 'scope': 'postgres', u'\xa0 \xa0 initdb': [{‘encoding’: ‘UTF8’}, ‘data-checksums’], u’\xa0 \xa0 data_dir’: ‘/data/patroni’, u’\xa0 \xa0 pgpass’: ‘/tmp/pgpass’, ‘tags’: None, u’\xa0 \xa0 users’: None, u’\xa0 \xa0 parameters’: None, u’\xa0 \xa0 \xa0 \xa0 loop_wait’: 10, u’\xa0 \xa0 noloadbalance’: False, u’\xa0 \xa0 dcs’: None, u’\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 username’: ‘postgres’, u’\xa0 \xa0 host’: ‘192.168.0.186:2379′, u’\xa0 \xa0 \xa0 \xa0 admin’: None, u’\xa0 \xa0 clonefrom’: False, ‘postgresql’: None, ‘name’: ‘postgresql2′, u’\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 options’: [‘createrole’, ‘createdb’], ‘bootstrap’: None, u’\xa0 \xa0 \xa0 \xa0 replication’: None, u’\xa0 \xa0 pg_hba’: [‘host replication replicator 127.0.0.1/32 md5’, ‘host replication replicator 192.168.0.202/0 md5’, ‘host replication replicator 192.168.0.103/0 md5’, ‘host replication replicator 192.168.0.186/0 md5’, ‘host all all 0.0.0.0/0 md5’], u'\xa0 \xa0 \xa0 \xa0 postgresql': None}
[root@psql06 ~]#

Another variant is to also use jq to confirm file syntax:

[root@psql07 ~]# python3 -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < /etc/patroni.yml|jq
parse error: Invalid numeric literal at line 1, column 9
[root@psql07 ~]#

Need to edit the file manually to remove the special space characters and save once more.

Cheers,
Tom


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License