Comments (14)
Hello!
On Mon, Nov 12, 2012 at 11:37 AM, Jose Diaz-Gonzalez
[email protected] wrote:
Ah that makes sense. So how do I "install" it and reference from within my nginx configuration?
If you're using the ngx_openresty bundle (http://openresty.org ), then
you don't need to do anything because it includes and enables
lua-resty-redis by default. And you can just use it in your Lua code,
as in
local redis = require "resty.redis"
...
If you're using your own nginx + ngx_lua build, then just configure
the lua_package_path directive to add the path of your lua-resty-redis
install visible to ngx_lua's LUA_PATH search path, as in
# nginx.conf
http {
lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
...
}
Best regards,
-agentzh
from lua-resty-redis.
For reference, the error is as follows:
jose@mactaku-3:~/Sites/seatgeek $ brew install ./nginx-custom.rb --add-github-module=simpl/ngx_devel_kit --add-github-module=chaoslawful/lua-nginx-module --add-github-module=agentzh/lua-resty-redis
==> Downloading http://nginx.org/download/nginx-1.2.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-custom-1.2.4.tar.gz
==> Patching
patching file conf/nginx.conf
adding extra modules
- adding simpl from github...
- adding chaoslawful from github...
- adding agentzh from github...
==> ./configure --prefix=/usr/local/Cellar/nginx-custom/1.2.4 --with-http_ssl_module --with-pcre --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/
checking for Lua library ... found
checking for export symbols by default ... not found
+ ngx_http_lua_module was configured
adding module in /private/tmp/nginx-custom-Ai9a/nginx-1.2.4/modules/agentzh/lua-resty-redis
./configure: error: no /private/tmp/nginx-custom-Ai9a/nginx-1.2.4/modules/agentzh/lua-resty-redis/config was found
from lua-resty-redis.
Hello!
On Mon, Nov 12, 2012 at 11:17 AM, Jose Diaz-Gonzalez
[email protected] wrote:
This file is necessary to install lua-resty-redis into a custom nginx compilation. Is it available somewhere, or is this meant to be part of another module somehow?
lua-resty-redis is not an Nginx C module. It is a pure Lua library
that can be directly required from within your Lua code running via
the ngx_lua module.
Best regards,
-agentzh
from lua-resty-redis.
Ah that makes sense. So how do I "install" it and reference from within my nginx configuration?
from lua-resty-redis.
After I include the lua_package in it's path, I can use it as in your openresty example?
from lua-resty-redis.
Hello!
On Mon, Nov 12, 2012 at 12:05 PM, Jose Diaz-Gonzalez
[email protected] wrote:
After I include the lua_package in it's path, I can use it as in your openresty example?
Which example?
-agentzh
from lua-resty-redis.
Something like:
http {
lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
local redis = require "resty.redis"
...
}
from lua-resty-redis.
Hello!
On Mon, Nov 12, 2012 at 12:16 PM, Jose Diaz-Gonzalez
[email protected] wrote:
Something like:
http { lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;"; local redis = require "resty.redis" ... }
Your nginx.conf syntax is not exactly right.
Look at the code sample in lua-resty-redis's README file:
https://github.com/agentzh/lua-resty-redis#synopsis
Best regards,
-agentzh
from lua-resty-redis.
So something like:
server {
lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
location /test {
content_by_lua '
local redis = require "resty.redis"
...
'
}
}
?
from lua-resty-redis.
Hello!
On Mon, Nov 12, 2012 at 12:23 PM, Jose Diaz-Gonzalez
[email protected] wrote:
So something like:
server {
lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";location /test { content_by_lua ' local redis = require "resty.redis" ... ' }
}
?
Try it and see what it says :) When in doubt, just try out the
openresty bundle instead to save your time.
Regards,
-agentzh
from lua-resty-redis.
Heh, will do. I mostly need a custom package - without some openresty stuff, and with other things - so just trying openresty won't solve all my problems.
Thanks for the advice, I'll let you know how it went and open a PR for this soon!
from lua-resty-redis.
Hello!
On Mon, Nov 12, 2012 at 8:11 PM, Jose Diaz-Gonzalez
[email protected] wrote:
Heh, will do. I mostly need a custom package - without some openresty stuff, and with other things - so just trying openresty won't solve all my problems.
I don't get it here. The openresty package is fully customizable. You
can disable things and add things, just with the standard nginx
distribution.
You can find all the options available with its ./configure script by
passing the --help option.
Regards,
-agentzh
from lua-resty-redis.
Hey @agentzh : I am using openresty to configure nginx to communicate to redis sentinels. But I am unable to connect to them as it says "no field package ['resty.redis.connector']" . Can you suggest a solution for connecting nginx with redis sentinels ?
from lua-resty-redis.
@Mahanteshambi Please do not hijack unrelated issues like this. It's annoying. Your questions should post to the openresty-en mailing list instead. See http://openresty.org/en/community.html
from lua-resty-redis.
Related Issues (20)
- SSL not working
- The performance of redis pipeline mode is unstable HOT 3
- CLIENT SETNAME?
- redis:get(key) question HOT 2
- opm package outdated HOT 1
- Connection pool not creating HOT 2
- How to create a single redis connection HOT 5
- this support two-way authentication?
- Add keepalive for redis client to make the connections reliable
- Nginx 1.24 HOT 2
- Nginx creates more connection than poolsize, backlog to redis HOT 5
- lua tcp socket read timed out, context: ssl_certificate_by_lua*, client: 172.69.58.204, server: 0.0.0.0:443 HOT 2
- redis set_keepalive doesn't work HOT 1
- lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/redis.lua:357: bad request HOT 2
- no request found HOT 1
- Add the host:port to the error message
- Reading from client: error:0A000126:SSL routines::unexpected eof while reading
- red:smembers("key"), sometime not include the new member? HOT 6
- [Feature Request] Pipeline coroutine safety HOT 6
- Redis: timeout HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-redis.