Raft with Patroni 3.0.1

Asked by jarred wilson

Hello! I am trying to configure patroni from the lunar repositories using raft dcs but am getting this error:

jardon@lagann:~/Projects/charmed-postgresql-snap$ cat /snap/charmed-postgresql/current/usr/lib/python3/dist-packages/
cdiff-1.0.egg-info colorama-0.4.6.dist-info/ patroni/ psutil-5.9.4.egg-info/ PyYAML-6.0.dist-info/ wcwidth/
cdiff.py dateutil/ patroni-3.0.1.egg-info/ psycopg2/ six-1.16.0.egg-info/ wcwidth-0.2.5.egg-info/
click/ dns/ prettytable/ psycopg2-2.9.5.egg-info/ six.py _yaml/
click-8.1.3.egg-info/ dnspython-2.3.0.dist-info/ prettytable-3.6.0.dist-info/ python_dateutil-2.8.2.egg-info/ urllib3/ yaml/
colorama/ etcd/ psutil/ python_etcd-0.4.5.egg-info/ urllib3-1.26.12.egg-info/
jardon@lagann:~/Projects/charmed-postgresql-snap$ cat /snap/charmed-postgresql/current/usr/lib/python3/dist-packages/^C
jardon@lagann:~/Projects/charmed-postgresql-snap$ sudo snap start charmed-postgresql.patroni
Started.
jardon@lagann:~/Projects/charmed-postgresql-snap$ sudo snap logs charmed-postgresql.patroni -n 40
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: return patroni_main()
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: File "/usr/lib/python3/dist-packages/patroni/__main__.py", line 136, in patroni_main
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: abstract_main(Patroni, schema)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: File "/usr/lib/python3/dist-packages/patroni/daemon.py", line 106, in abstract_main
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: controller = cls(config)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: File "/usr/lib/python3/dist-packages/patroni/__main__.py", line 25, in __init__
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: self.dcs = get_dcs(self.config)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: File "/usr/lib/python3/dist-packages/patroni/dcs/__init__.py", line 115, in get_dcs
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: raise PatroniFatalException("""Can not find suitable configuration of distributed configuration store
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985317]: patroni.exceptions.PatroniFatalException: 'Can not find suitable configuration of distributed configuration store\nAvailable implementations: etcd, etcd3, kubernetes'
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Main process exited, code=exited, status=1/FAILURE
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Failed with result 'exit-code'.
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Scheduled restart job, restart counter is at 4.
2023-03-01T14:48:31-05:00 systemd[1]: Stopped Service for snap application charmed-postgresql.patroni.
2023-03-01T14:48:31-05:00 systemd[1]: Started Service for snap application charmed-postgresql.patroni.
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: 2023-03-01 14:48:31,442 INFO: Failed to import patroni.dcs.consul
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: 2023-03-01 14:48:31,508 INFO: Failed to import patroni.dcs.exhibitor
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: 2023-03-01 14:48:31,517 INFO: Failed to import patroni.dcs.raft
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: 2023-03-01 14:48:31,519 INFO: Failed to import patroni.dcs.zookeeper
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: Traceback (most recent call last):
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/snap/charmed-postgresql/x1/usr/bin/patroni", line 33, in <module>
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: sys.exit(load_entry_point('patroni==3.0.1', 'console_scripts', 'patroni')())
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/usr/lib/python3/dist-packages/patroni/__main__.py", line 144, in main
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: return patroni_main()
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/usr/lib/python3/dist-packages/patroni/__main__.py", line 136, in patroni_main
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: abstract_main(Patroni, schema)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/usr/lib/python3/dist-packages/patroni/daemon.py", line 106, in abstract_main
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: controller = cls(config)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/usr/lib/python3/dist-packages/patroni/__main__.py", line 25, in __init__
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: self.dcs = get_dcs(self.config)
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: File "/usr/lib/python3/dist-packages/patroni/dcs/__init__.py", line 115, in get_dcs
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: raise PatroniFatalException("""Can not find suitable configuration of distributed configuration store
2023-03-01T14:48:31-05:00 charmed-postgresql.patroni[1985348]: patroni.exceptions.PatroniFatalException: 'Can not find suitable configuration of distributed configuration store\nAvailable implementations: etcd, etcd3, kubernetes'
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Main process exited, code=exited, status=1/FAILURE
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Failed with result 'exit-code'.
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Scheduled restart job, restart counter is at 5.
2023-03-01T14:48:31-05:00 systemd[1]: Stopped Service for snap application charmed-postgresql.patroni.
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Start request repeated too quickly.
2023-03-01T14:48:31-05:00 systemd[1]: snap.charmed-postgresql.patroni.service: Failed with result 'exit-code'.
2023-03-01T14:48:31-05:00 systemd[1]: Failed to start Service for snap application charmed-postgresql.patroni.
jardon@lagann:~/Projects/charmed-postgresql-snap$ /snap/charmed-postgresql/current/usr/bin/patroni --versin
Traceback (most recent call last):
  File "/snap/charmed-postgresql/current/usr/bin/patroni", line 33, in <module>
    sys.exit(load_entry_point('patroni==3.0.1', 'console_scripts', 'patroni')())
  File "/snap/charmed-postgresql/current/usr/bin/patroni", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 957, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 548, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for patroni

The config I'm using looks like this:

scope: "charmed-postgresql"
namespace: "/postgresql-common/"
name: postgresql

raft:
  data_dir: /home/ubuntu/postgresql/raft
  self_addr: '127.0.0.1:2222'

restapi:
  listen: 127.0.0.1:8008
  connect_address: 127.0.0.1:8008

bootstrap:
  dcs:
    ttl: 30
    loop_wait: 10
    retry_timeout: 10
    maximum_lag_on_failover: 1048576
    check_timeline: true
    postgresql:
      use_pg_rewind: true
      remove_data_directory_on_rewind_failure: true
      remove_data_directory_on_diverged_timelines: true
      use_slots: true
      pg_hba:
      - local all all peer
      - host all all 127.0.0.1/32 md5
      - host all all ::1/128 md5
      - local replication all peer
      - host replication all 127.0.0.1/32 md5
      - host replication all ::1/128 md5
postgresql:
  listen: "*:5432"
  connect_address: 127.0.0.1:5432
  data_dir: /home/ubuntu/postgresql/data
  bin_dir: /usr/lib/postgresql/14/bin
  config_dir: /home/ubuntu/postgresql/data
  pgpass: /home/ubuntu/postgresql/data/14-postgresql.pgpass
  authentication:
    replication:
      username: "replicator"
      password: "rep-pass"
    superuser:
      username: "postgres"
      password: "pg-pass"

Does the patroni that is shipped in the lunar repos support raft?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu patroni Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said :
#1

First lunar is still under development, which may have bugs.

Your print out has typo errors or format errors, line 136, line 106, line 25, line 115, etc.
You might re-check your output.

https://packages.ubuntu.com/lunar/patroni
Patroni has some issues with the package:
https://github.com/zalando/patroni/issues

Revision history for this message
jarred wilson (jardon) said :
#2

After some debugging, it appears I needed python3-pysyncobj which isnt marked as a dependency.

Ideally, I need postgres 14 with patroni 3, but the jammy packages dont ship that, and I know that mixing packages is generally frowned upon. Is there any plans to backport patron 3 to jammy?

Otherwise, I can stay on jammy and try to pull patroni 3 from pip.

Revision history for this message
Bernard Stafford (bernard010) said (last edit ):
#3

Patroni 3 is not in the Debian or Ubuntu repositories.
Here is a list of files for Patroni 2 :
https://packages.ubuntu.com/jammy/all/patroni/filelist
So far patroni 3 is a test build:
https://launchpad.net/~lvoytek/+archive/ubuntu/dp-test/+build/25633351

https://patroni.readthedocs.io/en/latest/ENVIRONMENT.html#kubernetes

Can you help with this problem?

Provide an answer of your own, or ask jarred wilson for more information if necessary.

To post a message you must log in.