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 ...
随机推荐
- 2Y - sort
给你n个整数,请按从大到小的顺序输出其中前m大的数. Input 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且都处于区间[-5000 ...
- Python 官方文件
7.2. 文件读写 函数 open() 返回 文件对象,通常的用法需要两个参数:open(filename, mode). >>> f = open('workfile', 'w') ...
- PAT 1087 有多少不同的值(20)(STL-set代码)
1087 有多少不同的值(20 分) 当自然数 n 依次取 1.2.3.--.N 时,算式 ⌊n/2⌋+⌊n/3⌋+⌊n/5⌋ 有多少个不同的值?(注:⌊x⌋ 为取整函数,表示不超过 x 的最大自然数 ...
- HTML JavaScript练习
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- CSS中(font和background)的简写形式
转自:http://blog.csdn.net/shenzhennba/article/details/7356095 1.字体属性主要包括下面几个:font-family(字体族): “Arial” ...
- CF Round #510 (Div. 2)
前言:没想到那么快就打了第二场,题目难度比CF Round #509 (Div. 2)这场要难些,不过我依旧菜,这场更是被\(D\)题卡了,最后\(C\)题都来不及敲了..最后才\(A\)了\(3\) ...
- synchronized Lock
synchronized和Lock都是Java语言提供的两种实现对共享资源进行同步的机制.其中synchronized使用Object对象本身的wait().notify().notifyAll()方 ...
- Spring 循环引用(一)一个循环依赖引发的 BUG
Spring 循环引用(一)一个循环依赖引发的 BUG Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring 循环 ...
- java如何实现发邮件功能。
http://blog.sina.com.cn/s/blog_59ca2c2a01013800.html http://www.cnblogs.com/xdp-gacl/p/4216311.html
- Partition Array into Disjoint Intervals LT915
Given an array A, partition it into two (contiguous) subarrays left and right so that: Every element ...