zoukankan      html  css  js  c++  java
  • kong命令(三)route

    介绍

    route 是一套匹配客户端请求的规则。每个route都会匹配一个service,每个service可定关联多个route。

    可以说service:route=1:n。一对多的关系。每个匹配到route的请求都会代理到对应的service上。

    路由可以设定不同的协议,不同的协议配置的属性不一样。官网介绍如下:

    • For http, at least one of methodshostsheaders or paths;
    • For https, at least one of methodshostsheaderspaths or snis;
    • For tcp, at least one of sources or destinations;
    • For tls, at least one of sourcesdestinations or snis;
    • For grpc, at least one of hostsheaders or paths;
    • For grpcs, at least one of hostsheaderspaths or snis.

    在kong网关服务中,可以和路由route匹配的有两类:service和plugin

    在操作route的命令中也可以依赖这两类进行操作。命令格式和service相似,都是使用restful api风格,区分再不同的http方法。

    接下来简单介绍

    1,add routes

    post 方法

    (1)http://127.0.0.1:8001/routes

    (2)http://127.0.0.1:8001//services/{service name or id}/routes  给指定的service 添加路由

     

    主要参数包括:name ,path(匹配该路由的路径),host(匹配该路由的域名列表),protocols(http、https),methods,service.id

     

    2,list routes ,Retrieve Route

    get 方法

    (1) http://127.0.0.1:8001/routes 展示所有routes

     

    (2)/services/{service name or id}/routes

    /routes/{route name or id}

     

    /services/{service name or id}/routes/{route name or id}

     

    /plugins/{plugin id}/route

     

    以上展示指定的route信息

     

    3,update routes 修改

    方法:patch

    (1)/routes/{route name or id}

     

    (2)/services/{service name or id}/routes/{route name or id}

    /plugins/{plugin id}/route

     

    4,create or update routes  存在时更新,不存在时创建

    方法:put

    (1)/routes/{route name or id}

     

    (2)/services/{service name or id}/routes/{route name or id}

    /plugins/{plugin id}/route

     

    5,delete route删除

    (1)/routes/{route name or id}

    (2)/services/{service name or id}/routes/{route name or id}

     

     


     

     人生在世,杂事七八;饭要少吃,事要多知;抽个时间,总结一下;乐在分享,自在提升 

     

  • 相关阅读:
    Perl分片技术
    Perl的time、localtime和gmtime函数
    Perl文件名通配和文件查找
    Perl复制、移动、重命名文件/目录
    Perl文件、目录常用操作
    Perl文件测试操作和stat函数
    Linux终端会话实时共享(kibitz)
    Perl的IO操作(2):更多文件句柄模式
    Perl的IO操作(1):文件句柄
    Perl文件句柄相关常量变量
  • 原文地址:https://www.cnblogs.com/jybky/p/11955758.html
Copyright © 2011-2022 走看看