PermalinkCLI Reference
PermalinkIntroduction
Kong comes with a CLI (Command Line Interface) which provides you with an interface to manage your Kong nodes. Each command is run in the context of a single node, since Kong has no cluster awareness yet.
Almost every command requires access to your configuration file in order to be aware of where the NGINX working directory is located (known as the prefix path for those familiar with NGINX) referenced as nginx_working_dir
in the Kong configuration file. If you haven’t already, we recommend you read the configuration reference.
Permalinkkong
$ kong [options] <command> [parameters]
Note For help information on a specific command use the --help
parameter: kong <command> --help
PermalinkOptions
--help
- Outputs help information--version
- Outputs kong version
Permalinkstart
Starts a Kong instance.
$ kong start [parameters]
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
When no configuration file is provided as an argument, Kong by default will attempt to load the a configuration file at /etc/kong/kong.yml
.
Should no configuration file exist at that location Kong will load the default configuration stored internally.
This file contains configuration for plugins, the datastore, and NGINX. You can read more about this file in the configuration guide.
Permalinkstop
Terminates a Kong instance by firing the NGINX stop
signal. This will execute a fast shutdown.
$ kong stop [parameters]
For more information regarding the NGINX signals, consult their documentation.
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
Passing the Kong configuration file path allows the termination of specific instance, should you not pass the configuration file location, the command will
default to the configuration at /etc/kong/kong.yml
or its internal default configuration.
Permalinkquit
Gracefully stops a Kong instance by firing the NGINX quit
signal.
$ kong quit [parameters]
For more information regarding the NGINX signals, consult their documentation.
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
Passing the Kong configuration file path allows the termination of specific instance, should you not pass the configuration file location, the command will
default to the configuration at /etc/kong/kong.yml
or its internal default configuration.
Permalinkrestart
This command sends NGINX a stop
signal, followed by a start
signal. If Kong was not running prior to the command, it will attempt to start it:
$ kong restart [parameters]
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
When no configuration file is provided as an argument, Kong by default will attempt to load the a configuration file at /etc/kong/kong.yml
.
Should no configuration file exist at that location Kong will load the default configuration stored internally.
This file contains configuration for plugins, the datastore, and NGINX. You can read more about this file in the configuration guide.
Permalinkreload
Reloads the NGINX configuration at runtime and avoids potential downtime by leveraging the NGINX reload signal.
$ kong reload [parameters]
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
Permalinkstatus
When Kong is started, also third-party services required by Kong are started along with it (like dnsmasq). This command checks that all the services required by Kong are running.
If one of these services fails, it will bring Kong to an unstable state and a kong restart
is recommended to be executed.
$ kong status
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
When no configuration file is provided as an argument, Kong by default will attempt to load the a configuration file at /etc/kong/kong.yml
.
Should no configuration file exist at that location Kong will load the default configuration stored internally.
This file contains configuration for plugins, the datastore, and NGINX. You can read more about this file in the configuration guide.
Permalinkmigrations
Run the datastore migrations (incremental changes to the datastore’s schema).
It can either run Kong core’s migrations, plugin by plugin, or all at the same time. Migrations can either run “up” or “down”. Up means it will prepare the datastore (create necessary tables, etc…). Down means it will revert any previous “up” step.
$ kong migrations [parameters] [list|up|down|reset]
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
When no configuration file is provided as an argument, Kong by default will attempt to load the a configuration file at /etc/kong/kong.yml
.
Should no configuration file exist at that location Kong will load the default configuration stored internally.
This file contains configuration for plugins, the datastore, and NGINX. You can read more about this file in the configuration guide.
Permalink-t <type>
Default: all
When running the up
or down
commands, specify core
or plugin_name
to only run specific migrations.
PermalinkCommands
- list: list migrations already executed (for which the datastore has been prepared).
- up: execute all migrations for the given type.
- down: revert the latest executed migration for the given type. This operation is desctructive.
- reset: reset your keyspace. This operation is desctructive.
Permalinkcluster
Manage the Kong cluster.
$ kong cluster [parameters] [members|force-leave|reachability|keygen]
PermalinkParameters
Permalink-c <configuration file path>
Kong Configuration File
When no configuration file is provided as an argument, Kong by default will attempt to load the a configuration file at /etc/kong/kong.yml
.
Should no configuration file exist at that location Kong will load the default configuration stored internally.
This file contains configuration for plugins, the datastore, and NGINX. You can read more about this file in the configuration guide.
Permalink-t <type>
PermalinkCommands
- members: shows a list of members in the cluster and their state.
- force-leave [node_name]: when a node is in a
failed
state, this operation forcebly removes the node from the cluster. Remembers to use thenode_name
and not its address. - reachability: performs a basic network reachability test. The local node will gossip out a “ping” message and request that all other nodes acknowledge delivery of the message.
- keygen: generates an encryption key that can be used for Kong intracluster traffic encryption with other nodes (see
encrypt
property in the cluster settings). The keygen command uses a cryptographically strong pseudo-random number generator to generate the key.