Data is not being replicated between patroni postgresql nodes

63 views Asked by At

Issue: Data is not being replicated between nodes. Postgres version: 14 I have set up patroni server with one leader and three replicas with HA proxy as load balancer. Automatic failover is working fine, when a leader is down patroni will bring up replica node as leader.

Below is the output when I list patroni cluster:

+ Cluster: postgres (7322782945008862801) ------+----+-----------+
| Member | Host               | Role     | State      | TL | Lag in MB |
+--------+----------------+---------+-----------+----+-----------+
| node1  | 10.113.123.155 | Leader  | running   |  1 |             |
| node2  | 10.113.123.156 | Replica | streaming |  1 |         0 |
| node3  | 10.113.123.157 | Replica | streaming |  1 |         0 |
| node4  | 10.113.123.158 | Replica | streaming |  1 |         0 |
+--------+----------------+---------+-----------+----+-----------+

/etc/patroni.yml is

    namespace: /db/
name: node1

restapi:
    listen: 10.113.123.155:8008 
    connect_address: 10.113.123.155:8008
etcd:
    hosts: 10.113.123.157:2379, 10.113.123.158:2379

bootstrap:
    dcs:
        ttl: 30
        loop_wait: 10
        retry_timeout: 10
        maximum_lag_on_failover: 1048576
        postgresql:
            use_pg_rewind: true

    initdb:
    - encoding: UTF8
    - data-checksums

    pg_hba:
    - host replication replicator 127.0.0.1/32 md5
    - host replication replicator 10.113.123.155/0 md5
    - host replication replicator 10.113.123.156/0 md5
    - host replication replicator 10.113.123.157/0 md5
    - host replication replicator 10.113.123.158/0 md5
    - host all all 0.0.0.0/0 md5 

    users:
        admin:
            password: admin
            options:
                - createrole
                - createdb

postgresql:
    listen: 10.113.123.155:5432
    connect_address: 10.113.123.155:5432
    data_dir: /dev/data/patroni/
    pgpass: /tmp/pgpass
    authentication:
        replication:
            username: replicator
            password: password
        superuser:
            username: postgres
            password: postgres
    parameters:
        unix_socket_directories: '.'

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

Any kind of help will be appreciated.

0

There are 0 answers