JPNagarajan
JPNagarajan

Reputation: 928

How to connect remote postgresql database from kong application?

I have a kong services which is in failed status with below error message from journalctl

/usr/local/share/lua/5.1/kong/cmd/migrations.lua:213: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: FATAL: password authentication failed for user "konguser"

postgres information from Kong.conf as below

cat /etc/kong/kong.conf|grep -i pg
pg_host = xxxx.yyyyy.ap-south-1.rds.amazonaws.com
pg_port = 5432                  # Port of the Postgres server.
pg_user = konguser                  # Postgres user.
pg_password = "zzzzzzz"                  # Postgres user's password.
pg_database = kong_db           # The database name to connect to.

Troubleshooted the same by trying to connect the same manually using psql as below and it worked

[root@ip-10-0-2-30 system]# psql -U konguser -p 5432 -h xxxx.yyyyy.ap-south-1.rds.amazonaws.com -d kong_db
Password for user konguser:
psql (10.15, server 10.9)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

kong_db=>

Not sure what is causing the failure.Could you please help to troubleshoot

Upvotes: 1

Views: 3912

Answers (1)

Ôrel
Ôrel

Reputation: 7632

Looks like your rds instance is using ssl. Default kong configuration is without ssl.

https://docs.konghq.com/gateway-oss/2.4.x/configuration/#postgres-settings

Two solution, remove ssl from rds, or activate it on kong side with

pg_ssl=on

Upvotes: 1

Related Questions