如何从kong应用程序连接远程postgresql数据库



我有一个kong服务,它处于失败状态,来自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"

来自Kong.conf的postgres信息如下

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.

通过尝试使用下面的psql手动连接,解决了同样的问题,它在中工作

[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=>

不确定是什么导致了故障。你能帮忙排除故障吗

看起来您的rds实例正在使用ssl。默认的kong配置没有ssl。

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

两个解决方案,从rds中删除ssl,或在kong侧用激活它

pg_ssl=on

最新更新