微服务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
时间: 2024-08-14 09:17:18

微服务Kong(七)——CLI参考的相关文章

spring cloud微服务实践七

在spring cloud 2.x以后,由于zuul一直停滞在1.x版本,所以spring官方就自己开发了一个项目 Spring Cloud Gateway.作为spring cloud微服务的网关组件. 注:这一个系列的开发环境版本为 java1.8, spring boot2.x, spring cloud Greenwich.SR2, IDE为 Intelli IDEA spring cloud gateway 入门 根据官方的简介,它是spring mvc基础之上,旨在提供一个简单有效的

微服务Kong(九)——认证参考

客户端访问上游API服务,通常由Kong的认证插件及其配置参数来控制. 通用认证 一般情况下,上游API服务都需要客户端有身份认证,且不允许错误的认证或无认证的请求通过.认证插件可以实现这一需求.这些插件的通用方案/流程如下: 1.向一个API或全局添加AUTH插件(此插件不作用于consumers): 2.常见一个consumer对象: 3.为consumer提供指定的验证插件方案的身份验证凭据: 4.现在,只要有请求进入Kong,都将检查其提供的身份验证凭据(取决于auth类型),如果该请求

微服务Kong(八)——代理参考

Kong侦听四个端口的请求,默认情况是: 8000:此端口是Kong用来监听来自客户端的HTTP请求的,并将此请求转发到您的上游服务.这也是本教程中最主要用到的端口. 8443:此端口是Kong监听HTTP的请求的端口.该端口具有与8000端口类似的行为,但是它只监听HTTPS的请求,并不会产生转发行为.可以通过配置文件来禁用此端口. 8001:用于管理员对KONG进行配置的端口. 8444:用于管理员监听HTTPS请求的端口. 在本文中,我们将介绍Kong的路由功能,并详细说明8000端口上的

微服务Kong(四)——添加插件

在本节中,您将学习到,如何配置使用KONG的插件来管理您的API.KONG的核心原则之一就是通过插件来实现API的扩展.插件可以使您更为简单的扩展和管理您的API. 在以下的步骤中,您将通过配置key-auth插件为您的API添加一个认证的功能.在添加此插件之前,您的所有API都被将代理到上游头.添加并配置此插件后,只有具有正确API密钥的请求会被代理 - 所有其他请求将被KONG拒绝,从而保护您的上游服务免受未经授权的使用,从而实现权限认证功能. 1. 为您的API配置 key-auth 插件

一个可供中小团队参考的微服务架构技术栈

一个可供中小团队参考的微服务架构技术栈 聊聊架构 2018-05-07 作者 杨波 作者 |  杨波编辑 |  张浩 近年,Spring Cloud 俨然已经成为微服务开发的主流技术栈,在国内开发者社区非常火爆.我近年一直在一线互联网公司(携程,拍拍贷等)开展微服务架构实践,根据我个人的一线实践经验和我平时对 Spring Cloud 的调研,我认为 Spring Cloud 技术栈中的有些组件离生产级开发尚有一定距离.比方说 Spring Cloud Config 和 Spring Cloud

微服务实践(总)-原文

本系列文章为 dockone.io 首发,转载请标明出处,以示尊重!! http://dockone.io/people/hokingyang   希望读者通过本系列文章对微服务优缺点有一个比较好的理解,以及何时使用这种架构.也许微服务架构比较适合你的应用.也许你正在开发一个大型.复杂单体式应用,日常开发和部署经验非常缓慢和痛苦,而微服务看起来是远方一个极乐世界.幸运的是,有可以参考的脱离苦海的策略,本篇文章中,我将描述如何逐步将单体式应用迁移到微服务架构. 本系列七篇文章列表如下: 微服务实战

微服务介绍及Asp.net Core实战项目系列之微服务介绍

0.目录 整体架构目录:ASP.NET Core分布式项目实战-目录 一.微服务选型 在做微服务架构的技术选型的时候,以"无侵入"和"社区活跃"为主要的考量点,将来升级为原子服务架构.量子服务架构的时候.甚至恢复成单体架构的时候,代价最小. 软件开发只需要组装,不再需要从头开发. 选型可以参考一下张队长的文章:https://mp.weixin.qq.com/s/UIFjm7W6bDfdmjpeMVJtqA 二.微服务架构是什么? 每一个微服务都是一个零件,并使用这

微服务技术选型之路

本文以笔者个人经历讲述关于微服务方面的技术选型和相关知识点.微服务模式的项目从初建到上线部署应用,每一个环节都会涉及到相当多的技术细节(上线后的性能调优更需要).本文着重介绍一套微服务搭建流程中面临的一些技术选型,战略性的技术方案及相关技术的简要介绍,不做每一项技术的深入说明. ?微服务简介 微服务是指开发一个单个小型的但有业务功能的服务,每个服务都有自己的处理和轻量通讯机制,可以部署在单个或多个服务器上.微服务也指一种种松耦合的.有一定的有界上下文的面向服务架构. 微服务是系统架构上的一种设计

在五分钟内创建,运行和部署Spring微服务

通过优锐课中的java学习分享中,我们可以看到在五分钟内创建,运行和部署Spring微服务的一些相关信息,码了很多知识点,整理给大家参考学习.对微服务架构又有了更深的了解,其中的架构思维导图梳理起来太清晰了. 使用IBM Cloud Developer Tools CLI插件创建,运行和部署Spring微服务 学习目标 使用IBM Cloud Developer Tools CLI生成Spring微服务,为其配置和绑定服务,然后部署到IBM Cloud. 了解所生成的代码,以及如何为你开始添加自