Lua Kafka使用

Lua Kafka使用

Lua Kafka使用

lua-resty-kafka,Lua kafka client driver for the Openresty based on the cosocket API。需要注意的是,不同于redis和mysql 客户端,kafka客户端并不是自带的,需要自行下载发布到openresty 的lualib目录下:

1
2
3
wget https://github.com/doujiang24/lua-resty-kafka/archive/master.zip
unzip master.zip
cp -r lua-resty-kafka-master/lib/resty/kafka /usr/local/openresty/lualib/resty/

当max_buffering参数设置过大时,出现table overflow

1
2
3
4
5
6
7
8
9
10
module.kafka_producer_conf = {
producer_type = "async",
socket_timeout=10000,
keepalive_size=200,
keepalive_timeout=10000,
flush_time = 5000,
batch_num = 100,
max_buffering= 5000000,
error_handle=batch_error_handle
}
1
[error] 7692#0: *8828748 lua entry thread aborted: runtime error: table overflow

将 max_buffering调小即可


 
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×