7

当我尝试在 Ubuntu 中启动 Kong 时出现以下错误

kong start [-c /path/to/kong.conf]
prefix directory /usr/local/kong not found, trying to create it
2017/11/05 21:11:41 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n"
Error: /usr/local/share/lua/5.1/pgmoon/init.lua:271: missing password, required for connect

我错过了什么吗?

4

5 回答 5

8

在您的 psql 上运行以下命令。 CREATE USER kong; CREATE DATABASE kong OWNER kong; ALTER USER kong WITH PASSWORD 'password';

创建具有以下内容的 kong.config。 pg_user = kong pg_password = password

运行迁移并启动 kong(可能需要 sudo) $ kong migrations up -c kong.config $ kong start -c kong.config

于 2017-11-16T07:51:49.727 回答
3

您的命令是正确的,您只需[从命令中删除“”。这表明 kong-documentaion 中的可选参数。所以正确的命令就是:

kong start -c /path/to/your/kong.conf

kong.conf确保事先更新并取消注释以下字段:

database = postgres (as in your case)
pg_host = your_host_address (127.0.0.1 by default)
pg_port = your_psql_port_address (5432 by default)
pg_user = your_psql_db_user (kong as per documentation of kong)
pg_password = your_psql_db_user's_password
pg_database = your_db_for_kong (kong as per documentation of kong)

如果建议的解决方案对您有所帮助,请接受它作为答案来结束问题。谢谢!

于 2018-03-20T09:03:42.540 回答
1

我有同样的错误,可能是你的 postgresql 版本太旧了:

kong start -c kong.conf 错误:[postgres 错误] Kong 需要 PostgreSQL 9.5 或更高版本(当前使用 9.2)

于 2018-06-25T16:05:53.740 回答
0

就我而言,我通过提供 kong.conf 文件的自定义路径来尝试该kong migrations bootstrap命令,但我得到了完全相同的错误:missing password, required for connect

kong migrations bootstrap在我看到的详细日志中,该命令总是在一组预定义的路径中查找 conf 文件

kong migrations bootstrap ./kong.conf --v
2021/02/05 09:51:52 [verbose] Kong: 2.3.1
2021/02/05 09:51:52 [verbose] no config file found at /etc/kong/kong.conf
2021/02/05 09:51:52 [verbose] no config file found at /etc/kong.conf
2021/02/05 09:51:52 [verbose] no config file, skip loading

所以我将 kong.conf 文件复制到 /etc/kong/ 并开始正常工作

于 2021-02-05T17:00:29.713 回答
0

once you go with @beebek's solution then you need to change the corresponding changes on the config files and then bootstrap the migrations with the command

kong migrations bootstrap

If you are on ubuntu follow with this doc

docs

And if you are looking into the db-less docs, Here is one

db-less

于 2021-02-17T07:56:19.970 回答