Use eval with redis2?
I am trying to use eval with the redis2 nginx plugin. I want to get the backend server name from redis.
I am trying with this:
location / {
eval_escalate on;
eval $answer { redis2_raw_query 'get server_name\r\n'; eval_override_content_type text/plain;
redis2_query get server_name;
redis2_pass 127.0.0.1:6379; } proxy_pass $answer;
But that doesn't work because the redis response has the string length at the beginning of the response. So you get:
2010/12/28 17:05:34 [error] 52979#0: *73 invalid URL prefix in "$24 http://127.0.0.1/foo//" while sending to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
Any ideas?
You better talk to the author of redis2 module.
@mcorner have you been able to make it work with Redis2?
I was able to make it work with http://wiki.nginx.org/HttpRedis
Here is my config:
location = /session { eval_escalate on; eval $session { set $redis_key $cookie_session; redis_pass [...]:6379; }
echo $session; }