openresty / redis2-nginx-module

Nginx upstream module for the Redis 2.0 protocol
http://wiki.nginx.org/HttpRedis2Module
901 stars 142 forks source link

Can't get back multi-bulk reply from lua #20

Open Fry-kun opened 11 years ago

Fry-kun commented 11 years ago

...or what I assume is a multi-bulk reply

Request command is EVAL, put together with redis.parser.build_query res = ngx.location.capture tells redis2 location that it's 1 query (also tried 2)

redis-lua returns following (tcpdump):

2 0 :1

First result is an empty zset result, 2nd is an integer... When I print out res, it's

unnamed = { ["status"] = 200; ["body"] = ""; ["header"] = { ["Content-Type"] = "application/octet-stream"; }; ["truncated"] = "false"; };

Redis commandline client says

1) (empty list or set) 2) (integer) 1

I'd try resty-redis, but I need nginx to shard the queries across multiple redis servers

agentzh commented 11 years ago

lua-redis-parser does not support recursive multi-bulk replies yet. You're recommended to use lua-resty-redis for it.

BTW, you can also use lua-resty-redis for multiple node sharding. Just calculate the target from a list of servers that you want to connect to in your own Lua code. And you can also make them share the same connection pool if you want.

Fry-kun commented 11 years ago

yeah, that's what I figured... but was trying to avoid re-setting up the sharding in resty guessing no plans to implement recursive multi-bulk replies any time soon?

agentzh commented 11 years ago

I don't have the time to implement recursive multi-bulk reply support in lua-resty-parser right now. You're welcome to submit a patch though :)

Fry-kun commented 11 years ago

fair enough :)