apinto OpenAPI

OpenApi

上游

查询列表

查询详情

 

新增

{

    "name": "jg_upstream",

    "driver": "http",

    "description": "通过postman添加上游",

    "scheme": "HTTPS",

    "retry":"1",

     "timeout": 1000,

    "nodes": [

        "127.0.0.1:80 weight=1"

    ],

     "balance": "round-robin",

    "pass_host": "node"

   

}

修改

如果名称或者id不存在则创建

{

    "driver": "http",

    "description": "修改通过postman添加上游",

    "scheme": "HTTPS",

    "retry":"3",

     "timeout": 2000,

    "nodes": [

        "127.0.0.2:80 weight=1"

    ],

     "balance": "round-robin",

    "pass_host": "node"

   

}

删除

根据名字或者id

应用

查询列表

查询详情

新增

{

    "additional": [],

    "anonymous": false,

    "auth": [

        {

            "config": {

                "expire": 0,

                "password": "jg_app",

                "username": "jg_app"

            },

            "position": "header",

            "token_name": "Authorization",

            "type": "basic",

            "users": [

                {

                    "expire": 0,

                    "hide_credential": false,

                    "pattern": {

                        "password": "jg_app",

                        "username": "jg_app"

                    }

                }

            ]

        }

    ],

    "description": "postman新增应用",

    "driver": "app",

    "id": "jg_app@app",

    "labels": {},

    "name": "jg_app"

}

修改

{

    "additional": [],

    "anonymous": false,

    "auth": [

        {

            "config": {

                "expire": 0,

                "password": "jg_app1",

                "username": "jg_app1"

            },

            "position": "header",

            "token_name": "Authorization",

            "type": "basic",

            "users": [

                {

                    "expire": 0,

                    "hide_credential": false,

                    "pattern": {

                        "password": "jg_app1",

                        "username": "jg_app1"

                    }

                }

            ]

        }

    ],

    "description": "修改postman新增应用",

    "driver": "app",

    "labels": {},

    "name":"修改了名字"

}

删除

API

查询列表

http://172.30.4.85:9400/api/router

查询详情

新增

#当http请求同时满足以下条件时才能匹配这个路由

#method为GET或者POST

#请求头内host的值后缀为.com

#请求路径uri为/demo

#头部存在name这个key,且对应值不为空值

#请求参数里包含key为id,且值不为123

{

"name": "complex_router",

"driver": "http",

"description": "一个匹配规则较复杂的路由",

"listen": 8099,

"method": [

"GET",

"POST"

],

"location": "/demo",

"host": ["*.com"],

"rules": [

  {

    "type":"header",

    "name":"user",

    "value":"apinto"

  }

],

"service": "anonymous_service@service",

"template": ""

}

Plugin:自定义的插件

proxy_rewrite:重定向

{

    "description": "新增api",

    "disable": false,

    "driver": "http",

    "host": [],

    "listen": 0,

    "location": "/jg/delete",

    "method": [

        "DELETE"

    ],

    "name": "jg_api",

    "plugins": {

        "proxy_rewrite": {

            "config": {

                "headers": {},

                "host_rewrite": false,

                "not_match_err": true,

                "path_type": "prefix",

                "prefix_path": [

                    {

                        "prefix_path_match": "/test",

                        "prefix_path_replace": "/test"

                    }

                ]

            },

            "disable": false

        }

    },

    "profession": "router",

    "retry": 0,

    "rules": [],

    "service": "upstream_test@service",

    "template": "",

    "time_out": 10000,

    "websocket": false

}

修改

{

    "description": "新增api",

    "disable": false,

    "driver": "http",

    "host": [],

    "listen": 0,

    "location": "/delete",

    "method": [

        "DELETE"

    ],

    "name": "jg_api",

    "plugins": {

        "proxy_rewrite": {

            "config": {

                "headers": {},

                "host_rewrite": false,

                "not_match_err": true,

                "path_type": "prefix",

                "prefix_path": [

                    {

                        "prefix_path_match": "/delete", //代理path

                        "prefix_path_replace": "/test" //数据源地址

                    }

                ]

            },

            "disable": false

        }

    },

    "profession": "router",

    "retry": 0,

    "rules": [],

    "service": "upstream_test@service",

    "template": "",

    "time_out": 10000,

    "websocket": false

}

删除

策略

查询列表类型

查询策略列表

http://172.30.4.85:9400/api/strategy

查询策略详情

删除

访问策略

筛选的是所有的10.11.55.82服务器发送的get方法,

新增

过滤规则和生效规则,可以理解为什么可以做或不能做什么

如拒绝82服务发起的get请求,生效范围是所有请求

{

    "description": "拒绝策略",

    "driver": "visit",

    "filters": {

        "ip": [

            "10.11.55.82"

        ],

        "method": [

            "GET"

        ]

    },

    "name": "ip_get",

    "priority": 1,

    "profession": "strategy",

    "stop": false,

    "visit": {

        "continue": false,

        "influence_sphere": {

            "api": [

                "ALL"

            ]

        },

        "visit_rule": "refuse"

    }

}

修改

流量限制

新增

{

    "description": "",

    "driver": "limiting",

    "filters": {

        "method": [

            "ALL"

        ]

    },

    "limiting": {

        "metrics": [

            "{api}"

        ],

        "query": {

            "hour": 10000,

            "minute": 1000,

            "second": 100

        },

        "response": {

            "body": "{    \"msg\":\"很抱歉,$api 暂停服务,请稍候再试!,被流控了1111\"}",

            "charset": "UTF-8",

            "content_type": "application/json",

            "status_code": 200

        },

        "traffic": {

            "hour": 10000,

            "minute": 1000,

            "second": 100

        }

    },

    "name": "jg_limite",

    "priority": 1,

    "profession": "strategy",

    "stop": false

}

修改

{

    "description": "修改流控",

    "driver": "limiting",

    "filters": {

        "method": [

            "ALL"

        ]

    },

    "limiting": {

        "metrics": [

            "{api}"

        ],

        "query": {

            "hour": 10000,

            "minute": 1000,

            "second": 100

        },

        "response": {

            "body": "{    \"msg\":\"很抱歉,$api 暂停服务,请稍候再试!,被流控了1111\"}",

            "charset": "UTF-8",

            "content_type": "application/json",

            "status_code": 200

        },

        "traffic": {

            "hour": 10000,

            "minute": 1000,

            "second": 100

        }

    },

    "name": "jg_limite",

    "priority": 1,

    "profession": "strategy",

    "stop": false

}

灰度发布

一部分用户继续用产品特性A,一部分用户开始用产品特性B,如果用户对B没有什么反对意见,那么逐步扩大范围,把所有用户都迁移到B上面来。

新增

{

    "description": "新增灰度",

    "driver": "grey",

    "filters": {},

    "grey": {

        "distribution": "percent",

        "keep_session": false,

        "matching": [],

        "nodes": [

            "172.30.4.81:4561"

        ],

        "percent": 4800

    },

    "name": "jg_huidu",

    "priority": 1,

    "profession": "strategy",

    "stop": false

}

修改

测试结果

5000代表50%,一次执行api本来地址,一次执行配置的新地址。

熔断

简单来说,用API的“出错比例”来表示这个API的健康状态,当这个比例值高于设定的阈值,API自动抛出异常,终止服务,这个过程就叫做自动熔断

Api有三种状态,健康期、观察期、熔断期

健康期正常转发到后端

熔断期直接返回预定的值

观察期允许转发到后端,失败达到阈值转入熔断期,成功达到预定阈值转入健康期

比如访问服务每秒失败三次进入熔断期,设置熔断持续时间2(2秒为基准,乘以连续熔断次数,第1次熔断时间为2秒,连续第2次熔断时间为2秒乘以2为4秒),达到熔断时间进入观察期,可以正常请求后端,请求成功达到每秒3次进入健康期,请求失败达到每秒2次则再次进入熔断,随着连续熔断次数增多,熔断时间会越来越大,设置最大熔断持续时间500。设置熔断响应内容

新增

{

    "description": "新增熔断",

    "driver": "fuse",

    "filters": {

        "api": [

            "659bbf16-9c59-5414-8247-fde143eb783b"

        ],

        "method": [

            "GET"

        ]

    },

    "fuse": {

        "fuse_condition": {

            "count": 1,

            "status_codes": [

                500

            ]

        },

        "fuse_time": {

            "max_time": 300,

            "time": 2

        },

        "metric": "{service}",

        "recover_condition": {

            "count": 3,

            "status_codes": [

                200

            ]

        },

        "response": {

            "body": "{    \"msg\":\"很抱歉,$api 暂停服务,请稍候再试!,被熔断了\"}",

            "charset": "UTF-8",

            "content_type": "application/json",

            "status_code": 200

        }

    },

    "name": "jg_rongduan",

    "priority": 1,

    "profession": "strategy",

    "stop": false

}

修改

{

    "description": "修改熔断",

    "driver": "fuse",

    "filters": {

        "api": [

            "659bbf16-9c59-5414-8247-fde143eb783b"

        ],

        "method": [

            "ALL"

        ]

    },

    "fuse": {

        "fuse_condition": {

            "count": 5,

            "status_codes": [

                500

            ]

        },

        "fuse_time": {

            "max_time": 200,

            "time": 2

        },

        "metric": "{service}",

        "recover_condition": {

            "count": 4,

            "status_codes": [

                200

            ]

        },

        "response": {

            "body": "{    \"msg\":\"很抱歉,$api 暂停服务,请稍候再试!,被熔断了\"}",

            "charset": "UTF-8",

            "content_type": "application/json",

            "status_code": 200

        }

    },

    "name": "jg_rongduan",

    "priority": 1,

    "profession": "strategy",

    "stop": false

}

服务发现

新增

http://172.30.4.85:9400/api/discovery

{

    "config": {

        "address": [

            "http://172.30.3.113:8848"

        ],

        "address_static": [

            "http://172.30.3.113:8848"

        ],

        "params": {

            "password": "nacos ",

            "username": "nacos"

        }

    },

    "description": "nacos服务发现22222222",

    "driver": "nacos",

    "name": "nacos_dis",

    "profession": "discovery"

}

修改

所有查询

172.30.4.84:9400/api/discovery

查询详情

172.30.4.85:9400/api/discovery/nacos_dis@discovery

上游服务绑定服务发现

http://172.30.4.84:9400/api/service

{

    "name": "nacos_up_postman",

    "driver": "http",

    "description": "postman新增nacos上游",

    "timeout": 1000,

    "retry": 3,

    "discovery": "nacos_dis@discovery",

    "service": "esb-console-biz",

    "balance": "round-robin",

    "pass_host": "node",

    "profession": "service",

    "scheme": "HTTP",

    "use_discovery": true

}

创建一个api绑定nacos服务发现

http://172.30.4.85:9400/api/router/

{

    "description": "post添加api通过nacos发现服务",

    "disable": false,

    "driver": "http",

    "host": [],

    "listen": 0,

    "location": "/console/v1/businesstagconfig",

    "method": [

        "GET"

    ],

    "name": "postman_api_nacos",

    "plugins": {

        "proxy_rewrite": {

            "config": {

                "headers": {},

                "host_rewrite": false,

                "not_match_err": true,

                "path_type": "prefix",

                "prefix_path": [

                    {

                        "prefix_path_match": "/console/v1/businesstagconfig",

                        "prefix_path_replace": "/console/v1/businesstagconfig"

                    }

                ]

            },

            "disable": false

        }

    },

    "profession": "router",

    "retry": 0,

    "rules": [

        {

            "type": "header",

            "name": "ss",

            "value": "dd"

        }

    ],

    "service": "nacos_up_postman@service",

    "template": "",

    "time_out": 10000,

    "websocket": false

}

插件

查询

172.30.4.85:9400/api/template/

查询详情

172.30.4.85:9400/api/template/cc4538eb-abb8-4f09-2d2d-7e4d35f9e3db@template

新增

172.30.4.85:9400/api/template

{

    "description": "postam 新增插件添加额外参数",

    "driver": "plugin_template",

    "name": "postman_plugin",

    "plugins": {

      

        "extra_params": {

            "config": {

                "error_type": "text",

                "params": [

                    {

                        "conflict": "origin",

                        "name": "addparamter",

                        "position": "header",

                        "value": "paramtervalue"

                    }

                ]

            },

            "disable": false

        }

    },

    "profession": "template"

}

API绑定插件

172.30.4.85:9400/api/router/

{

    "description": "新增api绑定插件模板",

    "disable": false,

    "driver": "http",

    "host": [],

    "listen": 0,

    "location": "/single/delete",

    "method": [

        "DELETE"

    ],

    "name": "template_api",

    "plugins": {

        "proxy_rewrite": {

            "config": {

                "headers": {},

                "host_rewrite": false,

                "not_match_err": true,

                "path_type": "prefix",

                "prefix_path": [

                    {

                        "prefix_path_match": "/single",

                        "prefix_path_replace": "/single"

                    }

                ]

            },

            "disable": false

        }

    },

    "profession": "router",

    "retry": 0,

    "rules": [],

    "service": "test@service",

    "time_out": 10000,

    "template":” postman_plugin@template",

    "websocket": false

}

日志

Kafka日志

查询

172.30.4.85:9400/api/output

查询详情

172.30.4.85:9400/api/output/kafka_access@output

新增

172.30.4.85:9400/api/output/

{

    "address": "127.0.0.1",

    "content_resize": [

        {

            "size": 11,

            "suffix": "log"

        }

    ],

    "description": "postman_kafaka日志",

    "driver": "kafka_output",

    "formatter": {

        "fields": [

            "$request_id",

            "$request",

            "$status",

            "@time",

            "@proxy",

            "$response_time"

        ],

        "proxy": [

            "$proxy_uri",

            "$proxy_scheme",

            "$proxy_addr"

        ],

        "time": [

            "$msec",

            "$time_iso8601",

            "$time_local"

        ]

    },

    "kafka_version": "3.1.0",

    "name": "kafka_access_postman",

    "partition_type": "hash",

    "profession": "output",

    "scopes": [

        "access_log"

    ],

    "timeout": 10,

    "topic": "ddd",

    "type": "json"

}

新增文件日志

{

    "content_resize": [

        {

            "size": 3,

            "suffix": "log"

        }

    ],

    "description": "postman 添加文件日志",

    "dir": "/var/log/apinto",

    "driver": "file",

    "expore": "3",

    "file": "access",

    "formatter": {

        "fields": [

            "$time_iso8601",

            "$request_id",

            "@request",

            "@proxy",

            "@response",

            "@status_code",

            "@time"

        ],

        "proxy": [

            "$proxy_method",

            "$proxy_scheme",

            "$proxy_uri",

            "$proxy_host",

            "$proxy_header",

            "$proxy_addr"

        ],

        "request": [

            "$request_method",

            "$scheme",

            "$request_uri",

            "$host",

            "$header",

            "$remote_addr"

        ],

        "response": [

            "$response_header"

        ],

        "status_code": [

            "$status",

            "$proxy_status"

        ],

        "time": [

            "$request_time",

            "$response_time"

        ]

    },

    "name": "postman_access",

    "period": "day",

    "profession": "output",

    "scopes": [

        "access_log"

    ],

    "type": "json"

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/620310.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

1063 计算谱半径

solution 找出虚部和实部平方和的最大值&#xff0c;输出该最大值的开方&#xff0c;保留两位小数 #include<iostream> #include<cmath> using namespace std; int main(){int n, a, b, ans 0;scanf("%d", &n);while(n--){scanf("%d%d"…

超便捷备忘录共享方法 文字文件都可共享

在这个信息爆炸的时代&#xff0c;备忘录已成为我们生活中不可或缺的小助手。它记录着我们的工作计划、待办事项、灵感闪现&#xff0c;甚至是那些温馨的家庭琐事。然而&#xff0c;当我们在不同的设备间穿梭&#xff0c;如何在手机、电脑&#xff0c;甚至是不同品牌的手机之间…

计算机辅助考试

加我zkhengyang可申请加入数字音频系统研究开发交流答疑群(课题组)&#xff0c;考神训练营&#xff0c;&#xff0c; 为了通过某项考试&#xff0c;可借助计算机(个人电脑)来辅助备考。本人通过电脑辅助学习&#xff0c;成功通过了驾照科目一&#xff0c;全国计算机二级C语言考…

新手做视频号电商,做什么样的产品好卖?适合不会选类目的新手看

大家好&#xff0c;我是电商花花&#xff0c;专注做电商的花花。 视频号现在的发展可以说是非常好的&#xff0c;拥有着空前的市场和流量&#xff0c;随着视频号小店新项目对电商的冲击&#xff0c;让更多创业者和新手商家开始涌入视频号电商的行列。 想要在新项目中抢占流量…

如何给远程服务器配置代理

目录 前言 正文 更换镜像源 开始之前 安装过程 遇到的问题 尾声 &#x1f52d; Hi,I’m Pleasure1234&#x1f331; I’m currently learning Vue.js,SpringBoot,Computer Security and so on.&#x1f46f; I’m studying in University of Nottingham Ningbo China&#x1f4…

java面试题(常见集合)

算法复杂度分析 时间复杂度分析 时间复杂度分析&#xff1a;来评估代码的执行耗时的 大O表示法&#xff1a;不具体表示代码真正的执行时间&#xff0c;而是表示代码执行时间随数据规模增长的变化趋势 空间复杂度 空间复杂度的全称是渐进空间复杂度&#xff0c;表示算法占用…

防爆巡检手持终端在燃气巡检作业中的应用

在燃气巡检作业中&#xff0c;安全始终是首要考虑的因素。面对易燃易爆的燃气环境&#xff0c;传统的巡检方式已经难以满足现代安全管理的需求。随着科技的不断进步&#xff0c;防爆巡检手持终端应运而生&#xff0c;成为燃气巡检作业的得力助手。这些终端不仅具备高度的防爆性…

docker-compose安装emqx集群(最新)(host模式)

机器&#xff1a; 10.60.0.20 10.60.0.21 10.60.0.22 一、三台机子都配置域名&#xff08;/etc/hosts&#xff09; 10.60.0.20 node1.emqx.io 10.60.0.22 node3.emqx.io 10.60.0.21 node2.emqx.io 二、docker-compose.yml&#xff08;10.60.0.21&#xff09; 其他两台机子自…

WordPress 、Typecho 站点的 MySQL/MariaDB 数据库优化

今天明月给大家分享一下 WordPress 、Typecho 站点的 MySQL/MariaDB 数据库优化&#xff0c;无论你的站点采用是 WordPress 还是 Typecho&#xff0c;都要用到 MySQL/MariaDB 数据库&#xff0c;我们以 MySQL 为主&#xff08;MariaDB 其实跟 MySQL 基本没啥大的区别&#xff0…

FHMG037、FHMG045、FHMG063比例电磁铁驱动放大器

该FHMG037、FHMG045、FHMG063比例电磁铁符合VDE0580&#xff0c;电枢空间耐压可达350 bar&#xff0c;也适用于干运行&#xff0c;磁力和在行程在横向工作范围内略有下降&#xff0c;与BEUEC比例放大器驱动工作&#xff0c;力值和电流之间很大程度上有比例关系&#xff0c;通过…

【单片机调试】mcu调试bug记录

【单片机调试】mcu调试bug记录 2023.5-2023.11待输入 2023.12-2023.22024.3-至今1.spi通信问题 2023.5-2023.11 待输入 2023.12-2023.2 辞职阶段&#xff1a;【STM32调试】寄存器调试不良问题记录持续版 2024.3-至今 1.spi通信问题 现象说明&#xff1a; mcu与afe芯片为spi通…

PDF Squeezer for Mac,让PDF压缩更高效

还在为PDF文件过大而烦恼吗&#xff1f;试试PDF Squeezer for Mac吧&#xff01;它拥有强大的压缩功能&#xff0c;可以快速将PDF文件压缩至更小的体积&#xff0c;让你的文件传输更快捷。同时&#xff0c;它还支持多种压缩方式&#xff0c;满足你的不同需求。赶快下载体验吧&a…

课题组里有一个卷王是什么体验?

::: block-1 “时问桫椤”是一个致力于为本科生到研究生教育阶段提供帮助的不太正式的公众号。我们旨在在大家感到困惑、痛苦或面临困难时伸出援手。通过总结广大研究生的经验&#xff0c;帮助大家尽早适应研究生生活&#xff0c;尽快了解科研的本质。祝一切顺利&#xff01;—…

【Linux】多线程相关第一篇:从进程谈起理解线程概念

文章目录 为什么需要线程初步认识Linux线程Linux操作系统的线程为什么要这么设计进程、线程关系梳理理解线程是CPU调度的基本单位简单认识多执行流如何划分代码 为什么需要线程 线程和进程的关系密不可分。 操作系统教材对于进程、线程的概念是这样描述的&#xff1a; 进程是…

秋招后端开发面试题 - JVM运行时数据区

目录 运行时数据区前言面试题JVM 内存区域 / 运行时数据区&#xff1f;说一下 JDK1.6、1.7、1.8 内存区域的变化&#xff1f;为什么使用元空间替代永久代作为方法区的实现&#xff1f;Java 堆的内存分区了解吗&#xff1f;运行时常量池&#xff1f;字符串常量池了解吗&#xff…

win server服务器 关闭危险端口 135,137,138,139,445的方法

通过防火墙来控制 打开控制面板 选择检查防火墙状态 选择高级设置 选择入站规则&#xff0c;再新建规则 选择端口&#xff0c;下一步 选择端口应用于啥协议&#xff0c;再指定端口&#xff0c;再下一步 选择阻止连接&#xff0c;下一步 下一步 给规则别名一下&#xff0c;方便…

STM32存储左右互搏 USB接口FATS文件读写U盘

STM32存储左右互搏 USB接口FATS文件读写U盘 STM32的USB接口可以例化为Host主机从而对U盘进行操作。SD卡/MicroSD/TF卡也可以通过读卡器转换成U盘使用。这里介绍STM32CUBEIDE开发平台HAL库实现U盘FATS文件访问的例程。 USB接口介绍 常见的USB接口电路部分相似而有不同的连接器…

Leetcode - 周赛396

目录 一&#xff0c;3136. 有效单词 二&#xff0c;3137. K 周期字符串需要的最少操作次数 三&#xff0c;3138. 同位字符串连接的最小长度 四&#xff0c;3139. 使数组中所有元素相等的最小开销 一&#xff0c;3136. 有效单词 本题就是一道阅读理解题&#xff1a; 字符串长…

Floyd+二分,蓝桥杯国赛2022[环境治理]

一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 0环境治理 - 蓝桥云课 (lanqiao.cn) 二、解题报告 1、思路分析 考虑我们治理时间越长&#xff0c;灰尘度和越低&#xff0c;具有单调性 考虑 二分治理天数mid&#xff0c;1~n可以降低与其相连边 mid / n 点…

[Linux][网络][协议技术][DNS][ICMP][ping][traceroute][NAT]详细讲解

目录 1.DNS1.DNS背景2.域名简介 2.ICMP协议1.ICMP功能2.ICMP两类报文 3.ping命令4.traceroute5.NAT技术1.NAT技术背景2.NAT IP转换过程3.静态地址NAT && 动态地址NAT4.网络地址端口转换NAPT5.NAT技术的缺陷6.NAT和代理服务器 6.总结1.数据链路层2.网络层3.传输层4.应用…