- Edited
少了local balancer定义是笔误。这个没有影响。
print("before require ngx.balancer")
local balancer = require("ngx.balancer")
print("after require ngx.balancer")
balancer.set_current_peer(host, port)
日志:
2016/04/13 09:27:00 [notice] 11982#0: *1 [lua] balancer_by_lua:12: before require ngx.balancer while connecting to upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8081"
2016/04/13 09:27:00 [notice] 11981#0: signal 20 (SIGCHLD) received
2016/04/13 09:27:00 [alert] 11981#0: worker process 11982 exited on signal 11
2016/04/13 09:27:00 [notice] 11981#0: start worker process 11986
2016/04/13 09:27:00 [notice] 11981#0: signal 23 (SIGIO) received
2016/04/13 09:27:00 [notice] 11981#0: signal 23 (SIGIO) received
在 2016年4月13日 上午1:07,黄华 <huangh...@gmail.com>写道:
upstream backend {server 0.0.0.0;balancer_by_lua_block {local balancer = require("ngx.balancer")balancer.set_current_peer("127.0.0.1",8080)};}这样使用的,暂未遇到该问题可以尝试下是否是未设定balancer为local导致的
在 2016年4月12日星期二 UTC+8下午4:11:54,Xiaoming Xie写道:新人一个,从事java开发居多,对c,lua是门外汉。按照样例:upstream backend {server 0.0.0.0;balancer_by_lua_block {require "ngx.balancer"balancer.set_current_peer(“127.0.0.1”, 8080)}}代码执行到require "ngx.balancer",nginx日志:2016/04/12 14:30:35 [notice] 27364#0: signal 20 (SIGCHLD) received2016/04/12 14:30:35 [alert] 27364#0: worker process 27366 exited on signal 112016/04/12 14:30:35 [notice] 27364#0: start worker process 273692016/04/12 14:30:35 [notice] 27364#0: signal 23 (SIGIO) received2016/04/12 14:30:35 [notice] 27364#0: signal 23 (SIGIO) receivedrequire "resty.lock" 模块没有问题是哪里需要特殊配置?编译么,请大家帮忙。--