0

I am trying to configure patroni and etcd. Etcd is working fine, but patroni is failing to start. I have 3 servers, I have installed patroni and etcd on each server. When I try to start patroni on primary server, I get this error:

INFO: Failed to import patroni.dcs.etcd

INFO: Failed to import patroni.dcs.etcd3

INFO: Failed to import patroni.dcs.exhibitor

INFO: Failed to import patroni.dcs.raft

INFO: Failed to import patroni.dcs.zookeeper

I have looked everywhere on internet, tried several set up methods, but none of them worked. etcd.py, etcd3.py and other files exist. I don't know why I get this error. Sometimes it works for 2-3 seconds, then fails.

Patroni.yml:

namespace: test
scope: postgres
name: node1

restapi:
    listen: [node1_ip]:8008
    connect_address: [node1_ip]:8008

etcd:
    hosts:[node1_ip]:2379,[node2_ip]:2379,[node3_ip]:2379

bootstrap:
    dcs:
        ttl: 30
        loop_wait: 10
        retry_timeout: 10
        maximum_lag_on_failover: 1048576

        postgresql:
            use_pg_rewind: true
            use_slots: true
            parameters:
                wal_level: replica
                hot_standby: "on"
                wal_keep_segments: 10
                max_wal_senders: 5
                max_replication_slots: 10
                wal_log_hints: "on"
                logging_collector: 'on'

    # 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 trust
        - host replication replicator 0.0.0.0/0 md5
        - host all all 0.0.0.0/0 md5
        - host all all ::0/0 md5
        - host all all [node1_ip]/32 md5
        - host all all [node2_ip]/32 md5
        - host all all [node3_ip]/32 md5

    # Some additional users which needs to be created after initializing new cluster
    users:
        admin:
            password: 111
            options:
                - createrole
                - createdb

postgresql:
  cluster_name: postgres
  listen: [node1_ip]:5451
  connect_address: [node1_ip]:5451
  data_dir: /tmp/patroni1
  bin_dir: /usr/pgsql-15/bin
  pgpass: /tmp/pgpass
  authentication:
    replication:
      username: replicator
      password: 111
    superuser:
      username: postgres
      password: 111
  parameters:
      unix_socket_directories: "/var/run/postgresql"
  create_replica_methods:
      - basebackup
  basebackup:
      checkpoint: 'fast'
#watchdog:
 # mode: required
 # device: /dev/watchdog
 # safety_margin: 5

tags:
    nofailover: false
    noloadbalance: false
    clonefrom: false
    nosync: false

And etcd.conf:

[Member]
ETCD_DATA_DIR="/var/lib/etcd/node1"
ETCD_LISTEN_PEER_URLS="http://[node1_ip]:2380,http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://[node1_ip]:2379,http://localhost:2379"


ETCD_NAME="node1"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://[node1_ip]:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://[node1_ip]:2379"
ETCD_INITIAL_CLUSTER="node1=http://[node1_ip],node2=http://[node2_ip]:2380,node3=http://[node3_ip]:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_AUTO_TLS="true"
ETCD_PEER_AUTO_TLS="true"

Is there a mistake somewhere? I cannot find any.

1
  • Were you able to solve it? To me it sounds like an etcd version mismatch. 2 days ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.