zhwaaaaaa / nginx-nacos-upstream Goto Github PK
View Code? Open in Web Editor NEWnginx nacos module. subscribe service and configuration from nacos instead of modifying and reloading nginx.conf
License: Apache License 2.0
nginx nacos module. subscribe service and configuration from nacos instead of modifying and reloading nginx.conf
License: Apache License 2.0
openresty的编译有点不同,求支持。
支持 nginx 订阅 nacos config。实现类似如下的配置
nacos {
# ....
}
http {
nacos_config_var $var_value_from_nacos data_id=nacos_key group_id=DEFAULT_GROUP;
server {
location {
return 200 $var_value_from_nacos;
}
}
}
modules/nacos/ngx_nacos_grpc.c: In function ‘ngx_nacos_grpc_update_send_window’:
modules/nacos/ngx_nacos_grpc.c:1637:33: error: ‘t’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1637 | st->non_block_bufs.tail = t;
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1453: objs/addon/nacos/ngx_nacos_grpc.o] Error 1
make[1]: Leaving directory '/home/martin/nginx-nacos-upstream'
make: *** [Makefile:10: build] Error 2
使用 nacos 支持路由信息动态变更和推送
表示看不懂实际的流程,可以写一下具体的操作流程?是下载nginx官方的包,然后将你的module放进去编译?
现在是 启动的时候同步订阅一下ip,然后启动 udp 端口接受推送。如果订阅的服务过多,启动变得非常慢。下一步计划
![image](https://user-images.githubusercontent.com/103627075/199382041-fc8c2d04-7b93-413d-8835-dd554fb71bf9.png)
我找了一个新环境重新git clone下来,make还是有报错,而且我对比了,报错与之前是一样的,而我去找到了您修改的源码,确认是用您新改的源码,能麻烦再帮忙指导看看吗?Thanks
Originally posted by @JayL946 in #5 (comment)
新增 如下命令,用于支持 配置的 lua 回调
subscribe_config_by_lua_block data_id=xxxx group=xxx {
local config_data = nacos.get_current_config_data()
local config_md5 = nacos.get_current_config_md5()
--- 通过 lua 自行处理 nacos 推送的配置
ngx.log(ngx.ERR, "config_data="..config_data.." config_md5="..config_md5)
}
-- 支持 lua 动态订阅配置
nacos.subscribe_config(data_id=xxxx, group=xxx, function(config_data, config_md5)
--- 通过 lua 自行处理 nacos 推送的配置
ngx.log(ngx.ERR, "config_data="..config_data.." config_md5="..config_md5)
end)
-- 支持 lua 动态订阅配置
local config_data, config_md5 = nacos.query_config(data_id=xxxx, group=xxx)
--- 通过 lua 自行处理 nacos 推送的配置
ngx.log(ngx.ERR, "config_data="..config_data.." config_md5="..config_md5)
-- 支持 lua 动态订阅配置
nacos.subscribe_service(service_name=xxxx, group=xxx)
-- 支持 lua 动态订阅配置
nacos.get_service_result(service_name=xxxx, group=xxx)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.