kong安装报错 /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:33: in function ‘check_state‘

文章描述了在启动Kong服务时遇到的警告和错误,提示数据库未初始化或者版本过旧。解决方案是运行Kong的迁移命令进行数据库初始化或升级到Kong1.5.0并转换apis实体。提供的Docker命令示例用于初始化数据库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误信息如下:

2023/06/01 22:32:35 [warn] 1#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
2023/06/01 22:32:35 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:33: Database needs bootstrapping or is older than Kong 1.0.

To start a new installation from scratch, run 'kong migrations bootstrap'.

To migrate from a version older than 1.0, migrated to Kong 1.5.0 first. 
If you still have 'apis' entities, you can convert them to Routes and Services
using the 'kong migrations migrate-apis' command in Kong 1.5.0.


stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:33: in function 'check_state'
    /usr/local/share/lua/5.1/kong/init.lua:628: in function 'init'
    init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:33: Database needs bootstrapping or is older than Kong 1.0.

To start a new installation from scratch, run 'kong migrations bootstrap'.

To migrate from a version older than 1.0, migrated to Kong 1.5.0 first. 
If you still have 'apis' entities, you can convert them to Routes and Services
using the 'kong migrations migrate-apis' command in Kong 1.5.0.


stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:33: in function 'check_state'
    /usr/local/share/lua/5.1/kong/init.lua:628: in function 'init'
    init_by_lua:3: in main chunk

报错原因,没有对kong使用的数据库进行初始化,执行以下命令即可:

docker run --rm --network=kong-net \ -e "KONG_DATABASE=postgres" \ -e "KONG_PG_HOST=kong-database" \ -e "KONG_PG_PASSWORD=kongpass" \ -e "KONG_PASSWORD=test" \ kong/kong-gateway:3.3.0.0 kong migrations bootstrap


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值