Kong网关的所有命令行指令都在 /usr/local/share/lua/5.1/kong/cmd 目录内。
cd /usr/local/share/lua/5.1/kong/cmd
check.lua debug.lua hybrid.lua migrations.lua quit.lua restart.lua runner.lua stop.lua vault.lua
config.lua health.lua init.lua prepare.lua reload.lua roar.lua start.lua utils version.lua
每个命令指令都是由一个lua脚本文件。常见的指令功能包括启动、停止、重启、重新加载、配置、检查、导出、数据迁移、查看版本等。
接下来介绍几个常用的控制指令。
目录
1 kong start
可以使用配置文件启动Kong服务, -c 参数用来指定启动的配置文件(.conf);--nginx-conf参数用来指定自定义的Nginx配置模板文件(.template)。使用--v参数,能够看到Kong服务器的启动过程日志。
kong@88faadc896da:/$ kong start --help
Usage: kong start [OPTIONS]
Start Kong (Nginx and other configured services) in the configured
prefix directory.
Options:
-c,--conf (optional string) Configuration file.
-p,--prefix (optional string) Override prefix directory.
--nginx-conf (optional string) Custom Nginx configuration template.
--run-migrations (optional boolean) Run migrations before starting.
--db-timeout (default 60) Timeout, in seconds, for all database
operations.
--lock-timeout (default 60) When --run-migrations is enabled, timeout,
in seconds, for nodes waiting on the
leader node to finis