Hello!
On Mon, Oct 15, 2012 at 6:44 PM, 岚偑/yy秋叶 wrote:
> 发现您发布的 https://github.com/chaoslawful/drizzle-nginx-module
> 例子中 红色的部分为需要修正的地方,是缺少或者需要修改
[...]
> local res = ngx.location.catpure("/query")
多谢指出此文档笔误!已经提交修复:
https://github.com/chaoslawful/drizzle-nginx-module/commit/3f8efb7
>
> 但是我发现我就算修改回来后,依旧无法使用 res.header["X-Mysql-Tid"] 获取到值! (ps 所有插件 我已经完全安装好了)
> 使用的数据库是mysql5.1 如果您有空的话希望可以回复我的邮件!
>
为使这个示例工作,你需要确保相关 Nginx 模块的加载顺序正确,因为这直接影响到这些模块的输出过滤器的执行顺序。引用文档中的原话则是:
“One pitfall here is that you have to add these modules in this order
while building Nginx:
HttpLuaModule
HttpHeadersMoreModule
HttpRdsJsonModule
Such that, their output filters will work in the reversed order, i.e.,
first convert RDS to JSON, and then add our X-Mysql-Tid custom header,
and finally capture the whole (subrequest) response with the Lua
module. You're recommended to use the OpenResty bundle though, it
ensures the module building order automatically for you. ”
你可以提供你目前的 nginx -V 的输出,以确认这几个模块的相对加载顺序。如果你在 Linux 上的话,也可以同时使用 Nginx
SystemTap Toolkit 中的 ngx-header-filters 工具确认正在运行中的 Nginx worker
进程中的过滤器顺序:
https://github.com/agentzh/nginx-systemtap-toolkit#ngx-header-filters
另外,我同时抄送给了 openresty 中文邮件列表:https://groups.google.com/group/openresty
(国内访问列表的首页可能需要翻墙)也欢迎你能加入那里讨论这样的问题 :)
Best regards,
-agentzh