官网: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. 安装 texlive

    多系统使用texlive 中文latex 用xelatex 编译 只需要加入宏包 \usepackage[UTF8]{ctex} Rmarkdown 配置模版 $ cat _output.yaml b ...

  2. 关于volatile关键字

    来源:衡阳网站优化 在java核心卷1中对volatile关键字是这么描述的: volatile关键字为实例域的同步访问提供了一种免锁机制.如果声明一个域为volatile,那么编译器和虚拟机就知道该 ...

  3. vim的背景配置

    1.vim背景颜色的配置 在usr/share/vim/vim74/colors   目录下有可以配置的颜色方案,可以查看: 命令:vim/etc/vimrc 打开vim的配置文件,   在最后加入一 ...

  4. 2019-ECfinal-M题-value

    题目传送门 sol:每个下标都有选和不选两种情况,所以总方案数是$2^{n}$,在$n$最大是$100000$的情况下不符合要求.可以这样想,假设$i^{p}=k$有符合题目要求的解,还有一个整数$j ...

  5. redis day02 下

    位图:是二进制数据(0101101010)2^32 强势点: 01_login :101110(比如:第一天登录,二天没登录) 传统的字符串解决方案中 记录用户登录日期  统计堪忧 01_login_ ...

  6. Point Estimation

    Point Estimation \(\bullet\)What is point estimation? Example: \(\bullet\) Bevan, Kullberg, and Rice ...

  7. 系统学习Javaweb5----JavaScript1

    注意:java和JavaScript没有半毛钱关系!!! 说明:过年歇着歇着不知不觉就歇了七天,嘿嘿,从今天开始继续学习. 学习笔记: 1.JavaScript概述. 1.1.JavaScript是什 ...

  8. windows下使用apache相关资料汇总

    1.Apache httpd.conf配置详解 https://www.cnblogs.com/langren1992/p/5160912.html 2.windows下使用apache经验总结 ht ...

  9. [LC] 106. Construct Binary Tree from Inorder and Postorder Traversal

    Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that ...

  10. 104)PHP,目录树状输出

    使用特定数量的缩进达到树状目的! 核心问题,计算需要缩进的数量! 缩进级别,与递归调用深度保持一致.每当执行一级递归操作,所找到的文件的缩进级别+; 语法实现: 增加一个参数,表示当前函数调用的深度级 ...