根据doc的说法,ngx.socket.tcp不能在日志阶段使用。https://github.com/openresty/lua-nginx-module#ngxsockettcp
但是我测试并发现,基于Lua-R校-mysql的ngx.socket.tcp可以在日志阶段使用,为什么?
发布于 2018-07-02 09:17:12
你的测试错了。
这里是小测试设置
如何运行:
docker-compose up
计算出nginx端口:
docker ps
测试:
curl 127.0.0.1:<port>
这就是证据:
nginx_1 | 2018/07/02 09:03:05 [error] 7#7: *1 failed to run log_by_lua*: /usr/local/openresty/lualib/resty/mysql.lua:520: API disabled in the context of log_by_lua*
nginx_1 | stack traceback:
nginx_1 | [C]: in function 'tcp'
nginx_1 | /usr/local/openresty/lualib/resty/mysql.lua:520: in function 'new'
nginx_1 | log_by_lua(nginx.conf:61):3: in function <log_by_lua(nginx.conf:61):1> while logging request, client: 192.168.112.1, server: , request: "GET / HTTP/1.1", host: "127.0.0.1:33195"https://stackoverflow.com/questions/51081581
复制相似问题