微服务Kong(七)——CLI参考

KONG提供了一套CLI(命令行界面)命令,您可以通过它来启动、停止和管理您的Kong实例。CLI管理您的本地节点(如在当前机器上)。

  全局配置

    所有命令都采用一组指定的可选标志作为参数:

      --help:显示命令行帮助信息

      --v:启动详情模式

      --vv:启动debug模式(noisy)

  可用的命令符

    kong check:

Usage: kong check <conf>

Check the validity of a given Kong configuration file.

<conf> (default /etc/kong.conf) configuration file

    kong cluster:

Usage: kong cluster COMMAND [OPTIONS]

Manage Kong's clustering capabilities.

The available commands are:
  keygen -c                   Generate an encryption key for intracluster traffic.
                              See 'cluster_encrypt_key' setting
  members -p                  Show members of this cluster and their state.
  reachability -p             Check if the cluster is reachable.
  force-leave -p <node_name>  Forcefully remove a node from the cluster (useful
                              if the node is in a failed state).
  keys install <key>          Install a new key onto Kong's internal keyring. This
                              will enable the key for decryption. The key will not
                              be used to encrypt messages until the primary key is
                              changed.
  keys use <key>              Change the primary key used for encrypting messages.
                              All nodes in the cluster must already have this key
                              installed if they are to continue communicating with
                              eachother.
  keys remove <key>           Remove a key from Kong's internal keyring. The key
                              being removed may not be the current primary key.
  keys list                   List all currently known keys in the cluster. This
                              will ask all nodes in the cluster for a list of keys
                              and dump a summary containing each key and the
                              number of members it is installed on to the console.

Options:
  -c,--conf   (optional string) configuration file
  -p,--prefix (optional string) prefix Kong is running at

    kong compile:

Usage: kong compile [OPTIONS]

Compile the Nginx configuration file containing Kong's servers
contexts from a given Kong configuration file.

Example usage:
  kong compile -c kong.conf > /usr/local/openresty/nginx-kong.conf

  This file can then be included in an OpenResty configuration:

  http {
      # ...
      include 'nginx-kong.conf';
  }

Note:
  Third-party services such as Serf need to be properly configured
  and started for Kong to be fully compatible while embedded.

Options:
  -c,--conf (optional string) configuration file

    kong health:

Usage: kong health [OPTIONS]

Check if the necessary services are running for this node.

Options:
  -p,--prefix (optional string) prefix at which Kong should be running

    kong migrations:

Usage: kong migrations COMMAND [OPTIONS]

Manage Kong's database migrations.

The available commands are:
  list   List migrations currently executed.
  up     Execute all missing migrations up to the latest available.
  reset  Reset the configured database (irreversible).

Options:
  -c,--conf (optional string) configuration file

    kong quit:

Usage: kong quit [OPTIONS]

Gracefully quit a running Kong node (Nginx and other
configured services) in given prefix directory.

This command sends a SIGQUIT signal to Nginx, meaning all
requests will finish processing before shutting down.
If the timeout delay is reached, the node will be forcefully
stopped (SIGTERM).

Options:
  -p,--prefix  (optional string) prefix Kong is running at
  -t,--timeout (default 10) timeout before forced shutdown

    kong reload:

Usage: kong reload [OPTIONS]

Reload a Kong node (and start other configured services
if necessary) in given prefix directory.

This command sends a HUP signal to Nginx, which will spawn
new workers (taking configuration changes into account),
and stop the old ones when they have finished processing
current requests.

Options:
  -c,--conf    (optional string) configuration file
  -p,--prefix  (optional string) prefix Kong is running at
  --nginx-conf (optional string) custom Nginx configuration template

    kong restart:

Usage: kong restart [OPTIONS]

Restart a Kong node (and other configured services like Serf)
in the given prefix directory.

This command is equivalent to doing both 'kong stop' and
'kong start'.

Options:
  -c,--conf    (optional string) configuration file
  -p,--prefix  (optional string) prefix at which Kong should be running
  --nginx-conf (optional string) custom Nginx configuration template

    kong start:

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

    kong stop:

Usage: kong stop [OPTIONS]

Stop a running Kong node (Nginx and other configured services) in given
prefix directory.

This command sends a SIGTERM signal to Nginx.

Options:
  -p,--prefix (optional string) prefix Kong is running at

    kong version:

Usage: kong version [OPTIONS]

Print Kong's version. With the -a option, will print
the version of all underlying dependencies.

Options:
  -a,--all    get version of all dependencies

 

  • --help: print the command's help message
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值