1

I'm not using Docker.

I've installed PostgreSQL 11 and created a user kong that owns a database kong. On the same linux box I've installed Kong, and am trying to get it to connect to the DB using these instructions.

Here's a snippet from kong.conf:

database = postgres
pg_host = 127.0.0.1
pg_port = 5432
pg_timeout = 5000
pg_user = kong
pg_password = Passw0rd!
pg_database = kong

Also, per this, I've modified pg_hba.conf to include:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust

Still, when I do:

kong migrations bootstrap -c /etc/kong/kong.conf

I get:

Error: [PostgreSQL error] failed to retrieve server_version_num: FATAL: Ident authentication failed for user "kong"

I've made sure PostgreSQL has the same password for kong that is in the kong.conf.

What am I missing?

4
  • you can try to use 'host all all 127.0.0.1/32 md5'
    – c4f4t0r
    Aug 28, 2019 at 19:47
  • @c4f4t0r, just tried md5. Same result. So I've changed back to trust which tells it to not even require a password.
    – Jonathan M
    Aug 28, 2019 at 19:53
  • Your trust method is ignored. Some classic reasons: 1) forgetting to reload the postgres service. 2) editing the wrong file 3) having rules above in the file taking precedence (the first match wins) Aug 29, 2019 at 12:55
  • @DanielVérité, good notes. I definitely reloaded the service and edited the correct file. However, I didn't know the first match wins. I'll give that a try.
    – Jonathan M
    Aug 29, 2019 at 13:21

1 Answer 1

0

Got it working. Two things:

  1. At the advice of @DanielVérité, I moved my trust methods to the top on pg_hba.conf. This is because he noted that the first match is what PostgreSQL goes with.

  2. In kong.conf, I thought I'd specified pg_host = 127.0.0.1, but I'd actually put the host name in there. Changed it back to 127.0.0.1 and it now works.

I hope this helps someone down the road.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .