Kong 网关 authentication exchange unsuccessful 报错

安装Kong网关过程中出现的错误,记录一下:

Error: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: authentication exchange unsuccessful

安装环境

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

Kong 安装

  1. 下载安装包
 curl $(rpm --eval "https://download.konghq.com/gateway-3.x-rhel-%{rhel}/config.repo") | sudo tee /etc/yum.repos.d/kong.repo
  1. kong 安装
sudo yum install kong-3.0.0

3.修改配置文件
安装完成后会生成默认的配置文件 /etc/kong/kong.conf.default. 修改配置文件名称:

cd /etc/kong
rename kong.conf.default kong.conf

kong网关可以不使用数据库,进行启动。我们适用数据库启动的方式启动 kong,Kong默认适用PGSQL作为数据库,因此需要安装PGSQL

PGSQL 安装

  1. 安装步骤
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
sudo yum install -y postgresql13-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl enable postgresql-13
sudo systemctl start postgresql-13
  1. 查看是否启动成功 在这里插入图片描述
  2. 创建账号密码
#1. 登录pg控制台
[root@localhost data]# su postgres
bash-4.2$ psql
psql (13.8)
Type "help" for help.

postgres=# 

# 2.执行脚本
CREATE USER kong WITH PASSWORD 'super_secret'; 
CREATE DATABASE kong OWNER kong;

kong 网关启动

  1. 修改配置文件
vim /etc/kong/kong.conf

在这里插入图片描述

  1. 启动kong
cd /etc/kong
kong migrations bootstrap -c kong.conf

# 系统报错
2022/10/10 23:07:09 [warn] Found dangling unix sockets in the prefix directory ("/usr/local/kong") while preparing to start Kong. This may be a sign that Kong was previously shut down uncleanly or is in an unknown state and could require further investigation.
2022/10/10 23:07:09 [warn] Attempting to remove dangling sockets before starting Kong...
2022/10/10 23:07:09 [warn] removing unix socket: /usr/local/kong/worker_events.sock
Error: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: authentication exchange unsuccessful

问题解决

  1. 修改PGSQL 加密方式
# 1.进入配置目录
cd /var/lib/pgsql/13/data

# 2.修改 postgresql.conf
password_encryption = md5

# 3.修改 pg_hba.conf

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

# 4. 重启PGSQL
systemctl restart postgresql-13

# 5. 启动kong gateway
cd /etc/kong
kong migrations bootstrap -c kong.conf

# 6. 验证kong gateway
curl -i http://localhost:8001

kong 相关命令

# 1. 重新加载
kong reload -c kong.conf

# 2. 启动
kong start -c kong.conf
  • 5
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 根据您提供的引用内容,报错信息显示认证失败,原因是用户名或密码无效。\[1\]在引用的配置文件中,可以看到用户名为"admin",密码为"1234admin"。请确保在配置文件中的用户名和密码与实际的用户名和密码一致,否则会导致认证失败。\[2\]另外,您还可以尝试修改boot.properties文件,将其中的用户名和密码内容删除,然后重新启动服务。\[3\]这样做可以清除之前保存的用户名和密码,以便重新输入正确的凭据进行认证。希望这些信息对您有帮助。 #### 引用[.reference_title] - *1* *2* [kafka SASL认证失败原因(failed authentication due to: Authentication failed: Invalid username or ...](https://blog.csdn.net/m0_37948170/article/details/119704004)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [WebLogic服务启动报错:Authentication denied: Boot identity not valid](https://blog.csdn.net/qq_36501591/article/details/79992690)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值