官网:https://konghq.com/

各种方式安装汇总:https://konghq.com/install/

命令列表:https://docs.konghq.com/0.14.x/admin-api/

官方插件列表:https://docs.konghq.com/hub/

相关学习笔记链接:https://www.lijiaocn.com/%E9%A1%B9%E7%9B%AE/2018/09/29/nginx-openresty-kong.html

相关博客:https://www.itcodemonkey.com/article/5980.html

Kong集群搭建博客:https://www.cnblogs.com/zhoujie/p/kong6.html

github:https://github.com/Kong

可视化程序dashboard github:https://github.com/PGBI/kong-dashboard

缓存插件github:https://github.com/globocom/kong-plugin-proxy-cache

kong配置文件默认地址:/etc/kong/kong.conf

kong插件默认地址:/usr/local/share/lua/5.1/kong/plugins

添加新插件时安装后需要在kong.conf中配置引入,proxy-cache插件安装前需要 luarocks install lua-resty-redis-connector

构建包含响应缓存插件的docker包:

Dockerfile:

From kong:latest

RUN apk update
RUN apk add git
RUN luarocks install lua-resty-redis-connector
RUN luarocks install kong-plugin-proxy-cache
RUN cp /etc/kong/kong.conf.default /etc/kong/kong.conf
RUN echo "plugins = bundled, proxy-cache" >> /etc/kong/kong.conf EXPOSE 8000 8001 8443 8444
docker build -t custom-kong .

导出image:

docker save > kong.tar custom-kong:latest

导入image:

docker load < kong.tar

Kong集群(完全无状态):

主节点启动(与数据库在一个docker network):

docker run -d --name kong \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p : \
-p : \
-p : \
-p : \
custom-kong:latest

其他节点:

docker run -d --name kong \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=10.95.55.185" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p : \
-p : \
-p : \
-p : \
custom-kong:latest

Kong集群前负载均衡nginx配置:

配置文件地址:/etc/nginx/nginx.conf

# include /...

upstream kongs {
server xx:xx:xx:xx:xx weight=;
server xx:xx:xx:xx:xx weight=;
}
# 修改http的请求头为源请求头
proxy_set_header Host $http_host;
proxy_set_header X-Forward-For $remote_addr; # 修改hearder支持加"_"
underscores_in_headers on; 
server {
listen ;
server_name kongs;
location / {
proxy_pass http://kongs;
}
}

API网关Kong的更多相关文章

  1. API 网关 Kong

    什么是 API 网关? 所谓网关,主要作用就是连接两个不同网络的设备,而今天所讲的 API 网关是指承接和分发客户端所有请求的网关层. 为什么需要网关层?最初是单体服务时,客户端发起的所有请求都可以直 ...

  2. Api网关Kong集成Consul做服务发现及在Asp.Net Core中的使用

    写在前面   Api网关我们之前是用 .netcore写的 Ocelot的,使用后并没有完全达到我们的预期,花了些时间了解后觉得kong可能是个更合适的选择. 简单说下kong对比ocelot打动我的 ...

  3. API网关Kong系列(一)初识

    最近工作需要,加上国内Kong的文章相对缺乏(搜来搜去就那么两篇文章),而且官方文档在某些demo上也有一些过时的地方,遂提笔记录下这些,希望能有帮助. 先随大流介绍下KONG(主要参考官网): 官方 ...

  4. API网关--Kong的实践

    1. 什么是Kong 目前互联网后台架构一般是采用微服务,或者类似微服务的形式,应用的请求通常需要访问多个后台系统.如果让每一个后台系统都实现鉴权.限流.负载均衡.审计等基础功能是不合适的,通用的做法 ...

  5. API网关Kong系列(三)添加服务

    进入之前部署好的kong-ui,默认第一次登陆需要配置kong服务的地址 进入API菜单,点击+号 按照要求填入相关信息 至此完成,可以使用诸如 https://your.domain.com:208 ...

  6. API网关Kong系列(二)部署

    部署环境: [OS] centos 6.8(如果是centos6.5,请自行先升级到6.8,否则不支持docker) [Docker] Client version: 1.7.1 Client API ...

  7. API网关Kong部署和使用文档

    KONG安装使用说明 系统版本:ubuntu14 1.下载安装包 $ wget https://github.com/Mashape/kong/releases/download/0.8.3/kong ...

  8. API网关——Kong实践分享

    概述 01 什么是Kong Kong是一个在Nginx中运行的Lua应用程序,可以通过lua-nginx模块实现,Kong不是用这个模块编译Nginx,而是与OpenRestry一起发布,OpenRe ...

  9. API网关Kong系列(四)认证配置

    目前根据业务需要先介绍2种认证插件:Key Authentication 及 HMAC-SHA1 认证  Key Authentication 向API添加密钥身份验证(也称为API密钥). 然后,消 ...

随机推荐

  1. Django2.0——路由配置

    URL配置就像是Django所支撑网站的目录,它的本质是URL模式以及要为该URL模式调用的视图函数之间的映射表.URL需要在urls.py进行配置,与其对应的视图函数写在views.py文件中.ur ...

  2. Centos7安装Xrdp远程桌面

    Xrdp是Microsoft远程桌面协议RDP的一个开源实现,它允许以图像方式控制远程系统. 测试环境 服务端: CentOS Linux release 7.7.1908 (Core) 客户端: W ...

  3. Nuxt.js学习(二) --- Nuxt目录结构详解、Nuxt常用配置项、Nuxt路由配置和参数传递

    [TOC] 1.Nuxt目录结构详解 Nuxt项目文件目录结构 |-- .nuxt // Nuxt自动生成,临时的用于编辑的文件,build |-- assets // 用于组织未编译的静态资源入LE ...

  4. spring+mybatis配置多个数据源

    http://www.cnblogs.com/lzrabbit/p/3750803.html

  5. redis day02

    Redis -带过期时间的key  如何删除掉的? 在redis内部有个  过期字典,所有带过期时间的都有过期字典 默认情况下 redis每秒会进行着10次过期字典的扫描,在每一次扫描过程里,执行如下 ...

  6. html5 一些好用的原生事件

    计算机技术发展这么多年, 有些方面太老了,不适合新时代的发展, 使用新的规范,更方便开发和使用, 提高各方使用人的工作效率, 何乐而不为 drag drop html5新增属性 某些操作使用拖拽比较方 ...

  7. 00 - 准备 Anaconda 环境

    Anaconda 环境 官方下载安装包:https://www.anaconda.com/download/ Anaconda Navigtor :用于管理工具包和环境的图形用户界面,后续涉及的众多管 ...

  8. D - Project Presentation(DFS序+倍增LCA)

    You are given a tree that represents a hierarchy in a company, where the parent of node u is their d ...

  9. day07-生成器

    一. 含有yield关键字的函数就是生成器函数. yield不能和return公用,且要写在函数内部. 调用生成器函数之后,函数不执行,返回一个生成器. 生成器的本质是迭代器.生成器generator ...

  10. sequelize 应用hook 实现对分表的访问

    https://github.com/cclient/sequelize-shardinghttps://www.npmjs.com/package/sequelize-sharding 实际有效的代 ...