CLI Reference

    If you haven’t yet, we recommend you read the configuration reference.

    All commands take a set of special, optional flags as arguments:

    • : print the command’s help message
    • --v: enable verbose mode
    • --vv: enable debug mode (noisy)

    Back to top


    kong config

    1. Usage: kong config COMMAND [OPTIONS]
    2. Use declarative configuration files with Kong.
    3. The available commands are:
    4. init [<file>] Generate an example config file to
    5. get you started. If a filename
    6. is not given, ./kong.yml is used
    7. by default.
    8. db_import <file> Import a declarative config file into
    9. the Kong database.
    10. db_export [<file>] Export the Kong database into a
    11. declarative config file. If a filename
    12. is not given, ./kong.yml is used
    13. by default.
    14. parse <file> Parse a declarative config file (check
    15. its syntax) but do not load it into Kong.
    16. Options:
    17. -c,--conf (optional string) Configuration file.
    18. -p,--prefix (optional string) Override prefix directory.

    Back to top


    kong health

    1. Usage: kong health [OPTIONS]
    2. Check if the necessary services are running for this node.
    3. -p,--prefix (optional string) prefix at which Kong should be running

    Back to top


    kong hybrid

    1. Usage: kong hybrid COMMAND [OPTIONS]
    2. Hybrid mode utilities for Kong.
    3. The available commands are:
    4. gen_cert [<cert> <key>] Generate a certificate/key pair that is suitable
    5. for use in hybrid mode deployment.
    6. Cert and key will be written to
    7. the current directory unless filenames are given.
    8. Options:
    9. -d,--days (optional number) Override certificate validity duration.
    10. Default: 1095 days (3 years)

    Back to top



    kong prepare

    This command prepares the Kong prefix folder, with its sub-folders and files.

    1. Usage: kong prepare [OPTIONS]
    2. Prepare the Kong prefix in the configured prefix directory. This command can
    3. be used to start Kong from the nginx binary without using the 'kong start'
    4. command.
    5. Example usage:
    6. kong migrations up
    7. kong prepare -p /usr/local/kong -c kong.conf
    8. nginx -p /usr/local/kong -c /usr/local/kong/nginx.conf
    9. Options:
    10. -c,--conf (optional string) configuration file
    11. -p,--prefix (optional string) override prefix directory
    12. --nginx-conf (optional string) custom Nginx configuration template

    kong quit

    1. Usage: kong quit [OPTIONS]
    2. Gracefully quit a running Kong node (Nginx and other
    3. configured services) in given prefix directory.
    4. This command sends a SIGQUIT signal to Nginx, meaning all
    5. requests will finish processing before shutting down.
    6. If the timeout delay is reached, the node will be forcefully
    7. stopped (SIGTERM).
    8. Options:
    9. -p,--prefix (optional string) prefix Kong is running at
    10. -t,--timeout (default 10) timeout before forced shutdown
    11. -w,--wait (default 0) wait time before initiating the shutdown


    kong reload

    1. Usage: kong reload [OPTIONS]
    2. Reload a Kong node (and start other configured services
    3. This command sends a HUP signal to Nginx, which will spawn
    4. new workers (taking configuration changes into account),
    5. current requests.
    6. Options:
    7. -c,--conf (optional string) configuration file
    8. -p,--prefix (optional string) prefix Kong is running at
    9. --nginx-conf (optional string) custom Nginx configuration template


    Back to top


    kong runner

    1. Usage: kong runner [file] [args]
    2. Execute a lua file in a kong node. the `kong` variable is available to
    3. reach the DAO, PDK, etc. The variable `args` can be used to access all
    4. arguments (args[1] being the lua filename being run).
    5. Example usage:
    6. kong runner file.lua arg1 arg2
    7. echo 'print("foo")' | kong runner

    kong start

    1. Usage: kong start [OPTIONS]
    2. Start Kong (Nginx and other configured services) in the configured
    3. prefix directory.
    4. Options:
    5. -c,--conf (optional string) Configuration file.
    6. -p,--prefix (optional string) Override prefix directory.
    7. --nginx-conf (optional string) Custom Nginx configuration template.
    8. --run-migrations (optional boolean) Run migrations before starting.
    9. --db-timeout (default 60) Timeout, in seconds, for all database
    10. operations (including schema consensus for
    11. Cassandra).
    12. --lock-timeout (default 60) When --run-migrations is enabled, timeout,
    13. in seconds, for nodes waiting on the
    14. leader node to finish running migrations.


    kong stop

    1. Usage: kong stop [OPTIONS]
    2. Stop a running Kong node (Nginx and other configured services) in given
    3. prefix directory.
    4. This command sends a SIGTERM signal to Nginx.
    5. -p,--prefix (optional string) prefix Kong is running at