pg_auto_failover icon indicating copy to clipboard operation
pg_auto_failover copied to clipboard

ERROR Connection to database failed: connection to server at "servername" (<ip address>), port 5000 failed: FATAL: no pg_hba.conf entry for host "<ip address>", user "postgres", database "postgres", SSL encryption

Open dannylu006 opened this issue 2 years ago • 0 comments

  1. Installed 14.4 PG software via https://www.postgresql.org/ftp/source/v14.4/
  2. Installed pg_auto_failover via https://github.com/citusdata/pg_auto_failover/tree/v1.6.4
  3. Ran below command to create the monitor server, but ran into error: pg_autoctl create monitor --ssl-self-signed --hostname localhost --auth trust --run
  4. Here is a snippet of the error: 10:29:45 4552 WARN Self-signed certificates provide protection against eavesdropping; this setup does NOT protect against Man-In-The-Middle attacks nor Impersonation attacks. 10:29:45 4552 WARN See https://www.postgresql.org/docs/current/libpq-ssl.html for details 10:29:45 4552 INFO Initialising a PostgreSQL cluster at "/servername/pg/monitor/data" 10:29:45 4552 INFO /hostname/pg/PostgreSQL-14.2/bin/pg_ctl initdb -s -D /servername/pg/monitor/data --option '--auth=trust' 10:29:46 4552 INFO /usr/bin/openssl req -new -x509 -days 365 -nodes -text -out /servername/pg/monitor/data/server.crt -keyout /servername/pg/monitor/data/server.key -subj "/CN=localhost" 10:29:46 4552 INFO Started pg_autoctl postgres service with pid 4569 10:29:46 4569 INFO /servername/pg/PostgreSQL-14.2/bin/pg_autoctl do service postgres --pgdata /hostname/pg/monitor/data -v 10:29:46 4552 INFO Started pg_autoctl listener service with pid 4570 10:29:46 4575 INFO /hostname/pg/PostgreSQL-14.2/bin/postgres -D /servername/pg/monitor/data -p 5000 -h * 10:29:46 4569 INFO Postgres is now serving PGDATA "/servername/pg/monitor/data" on port 5000 with pid 4575 10:29:46 4570 WARN Failed to connect to "postgres://postgres@servername:5000/postgres?", retrying until the server is ready 10:29:48 4570 ERROR Connection to database failed: connection to server at "servername" (), port 5000 failed: FATAL: no pg_hba.conf entry for host "", user "postgres", database "postgres", SSL encryption 10:29:48 4570 ERROR connection to server at "servername" (), port 5000 failed: FATAL: no pg_hba.conf entry for host "", user "postgres", database "postgres", no encryption 10:29:48 4570 ERROR Failed to connect to "postgres://postgres@servername:5000/postgres?" after 26 attempts in 2047 ms, pg_autoctl stops retrying now 10:29:48 4570 ERROR Failed to create user "autoctl" on local postgres server 10:29:48 4552 ERROR pg_autoctl service listener exited with exit status 12

QUESTION: It looks like the postgresql instance was created since we see all the required files are present in the PGDATA directory. However, it appears nothing related to pg_auto_failover objects are created since it has permission connecting to the instance as referenced by the error above.

Any feedback is greatly appreciated.

dannylu006 avatar Jun 23 '22 13:06 dannylu006