Kong:缺少用于连接的数据库
Kong : missing database for connect
我正在尝试为我的公司设置 Kong,我遵循了 Kong 文档中的说明。
首先我运行这个命令:
docker network create kong-net
然后这个命令:
docker run -d --name kong-database \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
根据文档,下一步是运行使用此命令进行迁移
docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" kong:latest kong migrations up
但它一直给我这个错误
Error: missing database for connect
完整日志
Error:
/usr/local/share/lua/5.1/pgmoon/init.lua:547: missing database for connect
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/pgmoon/init.lua:547: in function 'send_startup_message'
/usr/local/share/lua/5.1/pgmoon/init.lua:207: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:202: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:489: in function 'query'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:270: in function 'init'
/usr/local/share/lua/5.1/kong/db/init.lua:138: in function 'init_connector'
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:95: in function 'cmd_exec'
/usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:88>
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:45>
/usr/local/bin/kong:9: in function 'file_gen'
init_worker_by_lua:48: in function <init_worker_by_lua:46>
[C]: in function 'xpcall'
init_worker_by_lua:55: in function <init_worker_by_lua:53>
2020/07/23 03:38:40 [verbose] no config file found at /etc/kong/kong.conf
2020/07/23 03:38:40 [verbose] no config file found at /etc/kong.conf
2020/07/23 03:38:40 [verbose] no config file, skip loading
2020/07/23 03:38:40 [verbose] prefix in use: /usr/local/kong
我哪里错了?
请关注这个
步骤:1
docker run -d --name kong-database \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
postgres:9.6
步骤:2
docker run --rm \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong kong migrations up
步骤:3
docker run -d --name kong \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong
如果没有任何问题,您也可以使用此 docker-compose
已更新
version: "2"
services:
kong-database:
image: postgres:9.6
container_name: kong-database
ports:
- 5432:5432
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
kong:
image: kong:latest
command: "kong migrations bootstrap"
restart: always
links:
- kong-database:kong-database
ports:
- 8000:8000
- 8443:8443
- 8001:8001
- 7946:7946
- 7946:7946/udp
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_PASSWORD=kong
- KONG_PG_USER=kong
如果您需要 docker 的 3.7 版,请编写
我正在尝试为我的公司设置 Kong,我遵循了 Kong 文档中的说明。
首先我运行这个命令:
docker network create kong-net
然后这个命令:
docker run -d --name kong-database \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
根据文档,下一步是运行使用此命令进行迁移
docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" kong:latest kong migrations up
但它一直给我这个错误
Error: missing database for connect
完整日志
Error:
/usr/local/share/lua/5.1/pgmoon/init.lua:547: missing database for connect
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/pgmoon/init.lua:547: in function 'send_startup_message'
/usr/local/share/lua/5.1/pgmoon/init.lua:207: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:202: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:489: in function 'query'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:270: in function 'init'
/usr/local/share/lua/5.1/kong/db/init.lua:138: in function 'init_connector'
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:95: in function 'cmd_exec'
/usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:88>
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:45>
/usr/local/bin/kong:9: in function 'file_gen'
init_worker_by_lua:48: in function <init_worker_by_lua:46>
[C]: in function 'xpcall'
init_worker_by_lua:55: in function <init_worker_by_lua:53>
2020/07/23 03:38:40 [verbose] no config file found at /etc/kong/kong.conf
2020/07/23 03:38:40 [verbose] no config file found at /etc/kong.conf
2020/07/23 03:38:40 [verbose] no config file, skip loading
2020/07/23 03:38:40 [verbose] prefix in use: /usr/local/kong
我哪里错了?
请关注这个
步骤:1
docker run -d --name kong-database \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
postgres:9.6
步骤:2
docker run --rm \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong kong migrations up
步骤:3
docker run -d --name kong \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong
如果没有任何问题,您也可以使用此 docker-compose
已更新
version: "2"
services:
kong-database:
image: postgres:9.6
container_name: kong-database
ports:
- 5432:5432
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
kong:
image: kong:latest
command: "kong migrations bootstrap"
restart: always
links:
- kong-database:kong-database
ports:
- 8000:8000
- 8443:8443
- 8001:8001
- 7946:7946
- 7946:7946/udp
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_PASSWORD=kong
- KONG_PG_USER=kong
如果您需要 docker 的 3.7 版,请编写