首先,我在 ubuntu 16.04 中安装了 Kong 0.14.1(没有 docker)工作正常。
我尝试添加“会话”插件(按照插件页面的示例)
curl -X POST http://localhost:8001/services/1d57a271-1a70-42ac-bb37-2e60405af347/plugins \
--data "name=session" \
--data "config.storage=kong" \
--data "config.cookie_secure=false"
但它只是返回了 400 错误:
{"message":"schema violation (name: plugin 'session' not enabled; add it to the 'plugins' configuration property)","name":"schema violation","fields":{"name":"plugin 'session' not enabled; add it to the 'plugins' configuration property"},"code":2}
我意识到当前版本中不包含会话插件,因此我尝试使用以下命令升级到最新版本(1.1.2):
sudo dpkg -P kong-community-edition
wget -O kong-community-edition-1.1.2.trusty.all.deb https://bintray.com/kong/kong-community-edition-deb/download_file?file_path=dists/kong-community-edition-1.1.2.trusty.all.deb
sudo dpkg -i kong-community-edition-1.1.2.*.deb
sudo kong migrations up
sudo kong migrations finish
接下来是系统重新启动以确保。
现在,当我运行以下命令时,我可以看到我使用的是最新版本 1.1.2
dpkg -l | grep kong
但是在尝试启用包时我仍然遇到同样的错误。
使用 'sudo dpkg -P kong-community-edition' 卸载 kong 时,我确实收到了以下错误,但我不确定如何处理此警告,或者它是否与我的问题有关。
Removing kong-community-edition (1.1.2) ...
dpkg: warning: while removing kong-community-edition, directory '/usr/local/lib' not empty so not removed
dpkg: warning: while removing kong-community-edition, directory '/usr/local/bin' not empty so not removed
dpkg: warning: while removing kong-community-edition, directory '/usr/local/share' not empty so not removed
dpkg: warning: while removing kong-community-edition, directory '/usr/local/kong' not empty so not removed
我应该更正什么以允许我启用会话插件?
[更新]
如果我将此行添加到配置文件中:
plugins=bundled,session
然后,我在启动时收到此错误:
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:402: error loading plugin schemas: on plugin 'session': session plugin is enabled but not installed;