openresty / lua-resty-balancer

A generic consistent hash implementation for OpenResty/Lua
322 stars 77 forks source link

module 'ngx.balancer' not found ? #8

Closed Michael754267513 closed 7 years ago

Michael754267513 commented 7 years ago

dear : my nginx.conf is use to example,when i access to my nginx server, Nginx server response 500 and some error in error_log.

ENV [root@QA-PUB01 bin]# ./luajit -v LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/

[root@QA-PUB01 sbin]# ./nginx -V nginx version: nginx/1.11.8

nginx error log

2017/01/12 16:52:17 [error] 11661#0: 4 failed to run balancer_by_lua: balancer_by_lua:2: module 'ngx.balancer' not found: no field package.preload['ngx.balancer'] no file '/root/lua-resty-balancer-master/lib/ngx/balancer.lua' no file './ngx/balancer.lua' no file '/usr/local/share/luajit-2.1.0-beta1/ngx/balancer.lua' no file '/usr/local/share/lua/5.1/ngx/balancer.lua' no file '/usr/local/share/lua/5.1/ngx/balancer/init.lua' no file '/usr/local/nginx_lua/lua/ngx/balancer.so' no file './ngx/balancer.so' no file '/usr/local/lib/lua/5.1/ngx/balancer.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/usr/local/nginx_lua/lua/ngx.so' no file './ngx.so' no file '/usr/local/lib/lua/5.1/ngx.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' balancer_by_lua:2: in function while connecting to upstream, client: 192.168.2.145, server: , request: "GET / HTTP/1.1", host: "192.168.2.188:9999"

doujiang24 commented 7 years ago

@Michael754267513 Are you using OpenResty? If not you're highly recommended to use OpenResty: http://openresty.org/en/download.html

Michael754267513 commented 7 years ago

@doujiang24 ok.