官网: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. Methyl-SeqDNA的甲基化图谱|DNase I-Seq|ChIP-Seq|3C-Seq|

    生物医学大数据 Methyl-SeqDNA的甲基化图谱 DNase I-Seq全基因组染色质DNA的开放程度.非基因编码区的调控元件的分布 DNase I高敏感位点:基因处于转录活性状态时,其染色质结 ...

  2. Codeforces Round #624 (Div. 3)(题解)

    A. Add Odd or Subtract Even 思路: 相同直接为0,如果两数相差为偶数就为2,奇数就为1 #include<iostream> #include<algor ...

  3. c指针(2)

    #include<stdio.h> #include<malloc.h> #include<stdlib.h> typedef struct LNode { cha ...

  4. 查看opencv-python编译信息

    python -c "import cv2; print(cv2.getBuildInformation())" General configuration for OpenCV ...

  5. 自定义EL函数(转)

    有看到一个有趣的应用了,转下来,呵呵!! 1.定义类MyFunction(注意:方法必须为 public static) package com.tgb.jstl;         /**     * ...

  6. urlopen error [errno 10060]的解决思路

    当用多线程爬取某个网站的数据的时候,爬取一段时间后,总出现urlopen error [errno 10060]的错误,结果线程无端的被挂掉,一开始的解决思路是每次连接的时候换用不同的useragen ...

  7. 【ccf- csp201412-2】z字形扫描

    //ccf-Z字形扫描 #include<iostream> #include<cmath> using namespace std; #define N 500 int ma ...

  8. [概率DP]相逢是温厚

    题意 有\(n\)场比赛,他每次等概率地选择一场,选择的比赛可能有没ac过的题,他一定会ac这次比赛中的某一道,并说我好菜啊.如果全ac过了,也会说我好菜啊.求期望说多少次我好菜啊. 注意题目中每场题 ...

  9. SAP PM:参考维护工单创建测量凭证

    (1)使用FM:CO_BC_ORDER_POST获取工单资料(Aufnr, aufpo and materials etc): (2)使用FM:MEASUREM_DOCUM_RFC_SINGLE_00 ...

  10. 线性反馈移位寄存器(LFSR)-非线性反馈移位寄存器的verilog实现(产生伪随机数)

    一.线性反馈移位寄存器(LFSR) 通过对事先选定的种子做运算使得人工生成的伪随机序列的过程,在实际中,随机种子的选择决定了输出的伪随机序列的不同,也就是说随机种子的选择至关重要. 产生伪随机数的方法 ...