openresty + lua 4、openresty kafka
kafka 官网: https://kafka.apache.org/quickstart
zookeeper 官网:https://zookeeper.apache.org/
kafka 运行需要 zookeeper 支持,所以安装 kafka 的时候需要先安装 zookeeper.
kafka、zookeeper 的安装按照官网说的即可,我安装的时候没遇到什么问题,centos、mac都尝试安装了(mac 还是推荐使用 brew,很强大)
项目已经在使用 kafka 了,所以自己研究了下 openresty 和 kafka 的使用,遇到了如下的问题:
1、topic 不存在
// :: [error] #: * [lua] client.lua:: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:
// :: [error] #: * [lua] client.lua:: _fetch_metadata(): all brokers failed in fetch topic metadata, client: 127.0.0.1, server: localhost, request: "GET /test_kafka HTTP/1.1", host: "localhost:6699"
// :: [error] #: * [lua] client.lua:: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:
// :: [error] #: * [lua] producer.lua:: buffered messages send to kafka err: not found topic, retryable: true, topic: test, partition_id: -, length: , context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:
// :: [error] #: * lua entry thread aborted: runtime error: .../Cellar/openresty/1.11.2.5/lualib/resty/kafka/client.lua:: attempt to index local 'self' (a nil value)
stack traceback:
coroutine :
.../Cellar/openresty/1.11.2.5/lualib/resty/kafka/client.lua: in function 'refresh'
...zi_relation/exercise/lua_pro/mobile_login/kafka_demo.lua:: in function <...zi_relation/exercise/lua_pro/mobile_login/kafka_demo.lua:>, client: 127.0.0.1, server: localhost, request: "GET /test_kafka HTTP/1.1", host: "localhost:6699"
// :: [error] #: * lua entry thread aborted: runtime error: .../Cellar/openresty/1.11.2.5/lualib/resty/kafka/client.lua:: attempt to index local 'self' (a nil value)
wtf,怎么可能不存在呢,各种百度、google,也是简直了,就是不行。最后,皇天不负有心人呢,终于找到了一个文章,说是 kafka 的 server.properties 里必须要配置 host.name,说必须,
我想,我是没有配置这个,当时还在怀疑,这行吗,反正这样了,试试吧,怀着忐忑的心情,修改重启,结果还真可以了。我的苍天呢。
host.name=127.0.0.1
2、kafka、zookeeper 进程杀不掉(其实不能说是杀不掉,是杀掉,自己又重启了一个进程)
这个也是个很淡疼的问题,kill -9后没了,2-3 s后又有新的进程启动了,进程号变了。
这个问题现在还没有好,不知道 kafka 是几个意思。
不过,看到了一个设置
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
# This value is recommended to be increased for installations with data dirs located in RAID array.
num.recovery.threads.per.data.dir=
不知道,跟这个设置有没有关系。如果有懂的大神,敬请指导一、二。谢谢先。
好了,今天就到这里了。
openresty + lua 4、openresty kafka的更多相关文章
- openresty + lua 1、openresty 连接 mysql,实现 crud
最近开发一个项目,公司使用的是 openresty + lua,所以就研究了 openresty + lua.介绍的话,我就不多说了,网上太多了. 写这个博客主要是记录一下,在学习的过程中遇到的一些坑 ...
- openresty + lua 3、openresty http 调用
http 的话,openresty 已经集成,ng 的话,自己引入即可. github 地址:https://github.com/pintsized/lua-resty-http github 里提 ...
- openresty + lua 2、openresty 连接 redis,实现 crud
redis 的话,openresty 已经集成,ng 的话,自己引入即可. github 地址:https://github.com/openresty/lua-resty-redis github ...
- openresty+lua+kafka方案与Tomcat接口并发度对比分析
1.openresty+lua+kafka 1.1 openresty+lua+kafka方案 之前的项目基于nginx反向代理后转发到Tomcat的API接口进行业务处理,然后将json数据打入ka ...
- OpenResty + Lua + Kafka 实现日志收集系统以及部署过程中遇到的坑
********************* 部署过程 ************************** 一:场景描述 对于线上大流量服务或者需要上报日志的nginx服务,每天会产生大量的日志,这些 ...
- Openresty+Lua+Kafka实现日志实时采集
简介 在很多数据采集场景下,Flume作为一个高性能采集日志的工具,相信大家都知道它.许多人想起Flume这个组件能联想到的大多数都是Flume跟Kafka相结合进行日志的采集,这种方案有很多他的优点 ...
- 畅购商城(四):Lua、OpenResty、Canal实现广告缓存与同步
好好学习,天天向上 本文已收录至我的Github仓库DayDayUP:github.com/RobodLee/DayDayUP,欢迎Star,更多文章请前往:目录导航 畅购商城(一):环境搭建 畅购商 ...
- OpenResty + Lua访问Redis,实现高并发访问时的毫秒级响应打回
一.lua中redis的配置依赖: 1.OpenResty的lua访问redis的插件:https://github.com/openresty/lua-resty-redis 二.下载后,导入对应的 ...
- OpenResty的现状、趋势、使用及学习方法
Nginx 是俄罗斯人发明的, Lua 是巴西几个教授发明的,中国人章亦春把 LuaJIT VM 嵌入到 Nginx 中,实现了 OpenResty 这个高性能服务端解决方案. 通过 OpenRest ...
随机推荐
- PAT 1076 Wifi密码(15)(代码)
1076 Wifi密码(15 分) 下面是微博上流传的一张照片:"各位亲爱的同学们,鉴于大家有时需要使用 wifi,又怕耽误亲们的学习,现将 wifi 密码设置为下列数学题答案:A-1:B- ...
- CF402D Upgrading Array
原题链接 先用素数筛筛下素数,然后考虑贪心去操作. 先求前缀\(GCD\)(求到\(GCD\)为\(1\)就不用再往下求了),得到数组\(G[i]\),然后从后往前扫,如果\(f(G[i]) < ...
- Generate a Push Certificate
To send Push notification to an application/device couple you need an unique device token (see the O ...
- UOJ 274 温暖会指引我们前进 - LCT
Solution 更新掉路径上温暖度最小的边就可以了~ Code #include<cstdio> #include<cstring> #include<algorith ...
- 显示实现接口的好处c#比java好的地方
所谓Go语言式的接口,就是不用显示声明类型T实现了接口I,只要类型T的公开方法完全满足接口I的要求,就可以把类型T的对象用在需要接口I的地方.这种做法的学名叫做Structural Typing,有人 ...
- Eloquent Attach/Detach/Sync Fires Any Event
eloquent-attach-detach-sync-fires-any-event I have a laravel project, and I need to make some calcul ...
- Serial-mcu
任务: PC按下1键, mcu连续发送a, 当PC按下2键, 终止发送 查询: #include <reg52.h> #define uint unsigned int #define u ...
- 无法嵌入互操作类型"ESRI.ArcGIS.Carto.MapDocumentClass".请改用适用的接口
在对地图文档进行操作时,居然出现如下问题: IMapDocument m_MapDocument = new ESRI.ArcGIS.Carto.MapDocumentClass(); 报错: 无法嵌 ...
- IOS初级:NSTimer
@property (nonatomic, strong) NSTimer *timer; 添加定时器 self.timer = [NSTimer scheduledTimerWithTimeInte ...
- jQuery学习笔记:基础
本文主要总结jQuery中一些知识点 概念 美元符号$是著名的jQuery符号.jQuery把所有功能全部封装在一个全局变量jQuery中,而$也是一个合法的变量名,它是变量jQuery的别名 $本质 ...