nginx 安装 连接kafka 写日志

安装 luajit

下载 luajit : luajit.org/download/LuaJIT-2.1.0-beta1.tar.gz
tar -zxvf LuaJIT-2.1.0-beta1.tar.gz
cd LuaJIT-2.1.0-beta1
make PREFIX=/user/local/LuaJIT
make install PREFIX=/user/local/LuaJIT

export LUAJIT_INC=”/usr/local/LuaJIT/include/luajit-2.1″
export  LUAJIT_LIB=”/usr/local/LuaJIT/lib”

安装 nginx 集成环境 OpenResty
集成环境包含一般用到的  kit  jit  lua 等扩展

lua-resty-kafka nginx 连接 kafka 代码
正常下载安装,解压即可
https://github.com/doujiang24/lua-resty-kafka
根据 git中的说明配置

问题:可能出现的问题
1、引用文件路径问题,注意就好
2、kafka问题
no resolver defined to resolve “iZ25zrglnuiZ”
解析不到主机
修改     advertised.host.name=你的IP
advertised.port=你的端口

集群部署:
nginx 集群
kafka 集群,部署完成,修改 nginx 配置
local broker_list = {
{ host = “127.0.0.1”, port = 9092 },
{ host = “集群IP2”, port = 端口2 },
{ host = “集群IP3”, port = 端口3 },
}

 

相关博客:

http://blog.csdn.net/wonderisland/article/details/37923831

http://www.cnblogs.com/zdz8207/p/Nginx-Lua-OpenResty.html

 

nginx 测试配置

 

nginx_lua 连接kafka配置,摘自github

 

Tagged on: