介绍

upstream 就是一个虚拟的服务。可用于配置多个target目标服务时实现负载均衡的效果。

注意:service的host指的就是upstream的name。

同时upstream提供了一个health check方法,用于检查target目标服务是否健康。以此控制启用或禁用target目标服务

和upstream关联的kong模块:service ,target

主要参数:algorithm 负载算法:round-robin(默认), consistent-hashing, or least-connections

healthchecks.active.http_path 健康检查路径:默认/,该地址是指在目标服务器上,适用于目标服务器的所有请求

命令

1、add upstream

方法 post

api:/upstreams

2,list upstream ,retrieve upstream

方法:get

api:/upstreams

/upstreams/upstream id or name

/targets/{target host:port or id}/upstream   关联指定target目标服务的upstream

3,update upstream

方法:patch

api:/upstreams/{upstream name or id}

/targets/{target host:port or id}/upstream

4,create or update upstream

方法:put

api:/upstreams/{upstream name or id}

/targets/{target host:port or id}/upstream

5,delete

方法:delete

api:/upstreams/{upstream name or id}

/targets/{target host:port or id}/upstream

健康检查 health check

kong会发起对配置在upstream上的所有target进行健康检查,若检查失败,将会暂时移除不健康的target服务。

恢复之后会再次加入。具体参数可在upstream参数中配置。

检查结果主要为一下四大类(官网介绍)

  • If a Target fails to be activated in the balancer due to DNS issues, its status displays as DNS_ERROR.
  • When health checks are not enabled in the Upstream configuration, the health status for active Targets is displayed as HEALTHCHECKS_OFF.
  • When health checks are enabled and the Target is determined to be healthy, either automatically or manually, its status is displayed as HEALTHY. This means that this Target is currently included in this Upstream’s load balancer execution.
  • When a Target has been disabled by either active or passive health checks (circuit breakers) or manually, its status is displayed as UNHEALTHY. The load balancer is not directing any traffic to this Target via this Upstream.

上述HEALTHY 、HEALTHCHECKS_OFF情况,target目标可以被转发请求,其他两类不被负载转发。

查看:get方法。api:/upstreams/{name or id}/health/


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

最新文章

  1. sea.js模块化编程
  2. /etc/fstab 文件配置项简单介绍
  3. Ubuntu开启22端口
  4. nl命令详解
  5. OpenGL的几何变换4之内观察全景图
  6. Sql Server 存储过程使用技巧
  7. C语言之指针
  8. 手机APP有三类:原生APP,WebAPP,HybridApp
  9. 【IE6的疯狂之七】样式中文注释后引发失效
  10. OpenCV成长之路:直线、轮廓的提取与描述
  11. New Adventure----GUI Design Studio
  12. [SqlServer]如何向数据库插入带有单引号(')的字符串
  13. Android绘图机制(二)——自定义View绘制形, 圆形, 三角形, 扇形, 椭圆, 曲线,文字和图片的坐标讲解
  14. Busybox的syslogd认识与使用
  15. RobotFramework环境配置:默认以管理员权限运行cmd
  16. ECC椭圆曲线以及计算出公钥的过程(BTC为例)
  17. luoguP4709 信息传递 置换 + 多项式exp
  18. pgAdmin的数据恢复
  19. HTML5 Geolocation API地理定位整理(二)
  20. [J2EE]web.xml各个版本模板

热门文章

  1. 创建Bitmap之BitmapFactory
  2. osg create shape
  3. 在Vue中用富文本编辑器(可以ctrl+c粘贴)
  4. Java中使用队列Queue
  5. [CareerCup] Guards in a museum 博物馆的警卫
  6. 微信服务号一些记录,与DTCMS微信功能二次开发
  7. Ubuntu LVS DR模式生产环境部署
  8. dropout含义与原理
  9. 基于Jquery ui 可复用的酒店 web页面选择入住日期插件
  10. 轮播图CSS