hapostgres / hapostgres/pg_auto_failover

Certain .pgpass configs preventing pg_autoctl from setting up a standby node

Open
#835 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
142
Avg merge
5h 8m
Merged PRs (30d)
1

Description

This is a weird one. When using password auth, some entries in .pgpass make `pg_autoctl` to error when setting up replication, despite entries being valid and working fine with `pg_receivewal`

This .pgpass on a node works:

```
monitor:5432:*:autoctl_node:aaa
*:5432:*:pgautofailover_replicator:bbbb
```

This doesnt:

```
monitor:5432:*:autoctl_node:aaa
*:5432:replication:pgautofailover_replicator:bbbb
*:5432:postgres:pgautofailover_replicator:bbbb
```

With following error:

```
12:16:45 23 DEBUG pgsql.c:504 Connecting to [upstream] "postgres://pgautofailover_replicator@db-0.db:5432/?application_name=pgautofailover_standby_2&sslmode=prefer&replication=1"
12:16:45 23 WARN pgsql.c:595 Failed to connect to "postgres://pgautofailover_replicator@db-0.db:5432/?application_name=pgautofailover_standby_2&sslmode=prefer&replication=1", retrying until the server is ready
12:16:45 23 DEBUG pgsql.c:640 PQping(postgres://pgautofailover_replicator@db-0.db:5432/?application_name=pgautofailover_standby_2&sslmode=prefer&replication=1): slept 3 ms on attempt 2
12:16:45 23 DEBUG pgsql.c:654 PQping OK after 2 attempts
12:16:45 23 DEBUG pgsql.c:468 Connection to database failed: connection to server at "db-0.db" (10.1.0.234), port 5432 failed: fe_sendauth: no password supplied
```

It looks like a problem with `.pgpass`, but I belive that `.pgpass` is fine, because if get into standby node failing container, I can run replication without entering password:

```
postgres@db-1:/$ pg_receivewal -w -h db-0.db -U pgautofailover_replicator -D /tmp -v
pg_receivewal: starting log streaming at 0/1000000 (timeline 1)
```

## Environment

### docker image
All components run as docker containers, see Dockerfile included below

Dockerfile

```
# syntax = docker/dockerfile:1.3-labs
ARG POSTGRES_VERSION=14
ARG TIMESCALEDB_VERSION=2.5.0
FROM postgres:${POSTGRES_VERSION}-bullseye

## pg_auto_failover

RUN curl -L https://repos.citusdata.com/community/gpgkey | apt-key add -

COPY <

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.