I’m having problem with redis module: HTTP Redis | NGINX
(version 0.32 downloaded from mirror at
GitHub - elcuervo/nginx_http_redis: Mirror from wiki.nginx.org)
As I tried, variable $redis_db is never used and result always comes
from “default” - database 0.
Am I missing something in my config?
my nginx.conf (part of):
upstream { server 192.168.2.178:6379; keepalive 256 single;}
location /testredisselect0
{
default_type text/html;
set $redis_key “$uri?dbid=notdef”;
redis_pass redisbackend;
}
location /testredisselect1
{
default_type text/html;
set $redis_db “1”;
set $redis_key “$uri?dbid=1”;
redis_pass redisbackend;
}
curl “http://localhost/testredisselect0”
curl “http://localhost/testredisselect1”
result in redis monitor:
1307190385.099634 “select” “0”
1307190385.099688 “get” “/testredisselect0?dbid=notdef”
1307190387.739512 “select” “0”
1307190387.739561 “get” “/testredisselect1?dbid=1”
As I can see, command always issues select 0, although it should run
select 1 in second case.
Damir
Posted at Nginx Forum:
Did that rev actually compile and make without issue for you? I was
using that module a while back and ended up commenting out the below
line inorder for it to build successfully.
/* static ngx_str_t ngx_http_redis_db = ngx_string(“redis_db”); */
I wasn’t using different redis db’s at the time and didn’t look into it
much. I bet pipelining with agentzh’s redis2 would work just fine. I
saw your post over in the parser thread, did you give that a try yet?
Posted at Nginx Forum:
Hi.
On Sat, Jun 04, 2011 at 08:40:20AM -0400, logar.damir wrote:
I’m having problem with redis module: HTTP Redis | NGINX
(version 0.32 downloaded from mirror at
GitHub - elcuervo/nginx_http_redis: Mirror from wiki.nginx.org)
I don’t know anything about this URL. Original sources available
from http://people.freebsd.org/~osa/
As I tried, variable $redis_db is never used and result always comes
from “default” - database 0.
Am I missing something in my config?
[skipped]
As I can see, command always issues select 0, although it should run
select 1 in second case.
Patch.
@gregr401 I applied the patch to original redis module, as provided
by Sergey. It works great. Previous I used module from Git. Compiled OK.
Regarding Redis2: I use it when advanced processing is required
(pipeline, redis Lua script). When all I need is simple get with high
frequency I prefer strict C module.
@Sergey. Used original download url now and applied your patch. Work’s
great. Thanks again. Problem solved.
Result in redis monitor after patch applied.
1307496425.913180 “get” “/testredisselect0?dbid=notdef”
1307496426.063073 “select” “0”
1307496426.063085 “get” “/testredisselect0?dbid=notdef”
1307496428.237644 (db 1) “select” “1”
1307496428.237657 (db 1) “get” “/testredisselect1?dbid=1”
1307496428.985250 (db 1) “select” “1”
1307496428.985262 (db 1) “get” “/testredisselect1?dbid=1”
1307496429.165848 (db 1) “select” “1”
Posted at Nginx Forum: