使用ZeroBrane Studio调试kong源码

前置基础知识:

1、使用ZeroBrane Studio调试Openresty lua脚本请参考:https://blog.csdn.net/zhuankeshumo/article/details/79828080

2、OpenResty api网关设计 https://blog.csdn.net/zhuankeshumo/article/details/79393215

本文主要讲解使用ZeroBrane Studio调试kong源码步骤:

1、切换到kong next分支,并且安装luarocks,运行luarocks make

2、etc/kong/kong.conf配置lua_package_path和lua_package_cpath


lua_package_path = /home/caozhiyuan/ZeroBraneStudio-1.70/lualibs/?/?.lua;/home/caozhiyuan/ZeroBraneStudio-1.70/lualibs/?.lua;./?.lua;./?/init.lua;  # Sets the Lua module search path
                                           # (LUA_PATH). Useful when developing
                                           # or using custom plugins not stored
                                           # in the default search path.

lua_package_cpath = /home/caozhiyuan/ZeroBraneStudio-1.70/bin/linux/x64/clibs/?.so;            # Sets the Lua C module search path
                                 # (LUA_CPATH).

3、Kong.rewrite() 方法开始添加require('mobdebug').start('127.0.0.1')

4、docker方式安装kong数据库POSTGRES(https://docs.konghq.com/install/docker/),运行sudo bin/kong migrations up -c /etc/kong/kong.conf

5、sudo bin/kong start -c /etc/kong/kong.conf --vv

6、参考https://docs.konghq.com/0.14.x/getting-started/configuring-a-service/进行配置,访问http://localhost:8000/下配置的服务

7、kong源码理解

(1)、如何保证集群节点数据一致性?

 db数据变更->workerevents.post_local 删除本地缓存->cluster_events:broadcast删除本地缓存

 

 

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值