Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:agentzh/redis2-nginx-module

  • Loading branch information...
commit 05a0e22c0a94849b9b5889bee701269670dcb732 2 parents 21bb5c8 + 0103928
@agentzh agentzh authored
Showing with 52 additions and 0 deletions.
  1. +52 −0 README
View
52 README
@@ -200,6 +200,28 @@ Directives
redis2_buffer_size
redis2_next_upstream
+ syntax: memcached_next_upstream [ error | timeout | invalid_response | off ]
+ default: error timeout
+ context: http, server, location
+
+ Specify which failure conditions should cause the request to be forwarded to another
+ upstream server. Applies only when the value in redis2_pass is an upstream with two or more
+ servers.
+
+ Here's an artificial example:
+
+ upstream redis_cluster {
+ server 127.0.0.1:6379;
+ server 127.0.0.1:6380;
+ }
+
+ server {
+ location /redis {
+ redis2_next_upstream error timeout invalid_response;
+ redis2_query get foo;
+ redis2_pass redis_cluster;
+ }
+ }
Connection Pool
You can use Maxim Dounin's excellent ngx_http_upstream_keepalive module
@@ -336,6 +358,36 @@ Lua Interoperability
}
}
+Redis Publish/Subscribe Support
+ This module has limited support for redis publish/subscribe feature.
+ It cannot be fully supported due to the stateless nature of REST and
+ HTTP model.
+
+ Consider the following example:
+
+ location /redis {
+ redis2_raw_queries 2 "subscribe /foo/bar\r\n";
+ redis2_pass 127.0.0.1:6379;
+ }
+
+ And then publish a message for the key /foo/bar in the redis-cli
+ command line. And then you'll receive two multi-bulk replies from the
+ /redis location.
+
+ You can surely parse the replies with the lua-redis-parser library if
+ you're using Lua to access this module's location.
+
+ Some limitations:
+
+ 1. You cannot use ngx_http_upstream_keepalive with this redis
+ upstream. Only short redis connections will work.
+
+ 2. There may be some race conditions that produce the harmless "Redis
+ server returned extra bytes" warnings in your nginx's error.log. Such
+ warnings might be rare but just be prepared for it.
+
+ 3. You should tune the various timeout settings provided by ngx_redis2.
+
Performance Tuning
When you're using ngx_redis2, please ensure you're using a tcp
connection pool (provided by ngx_http_upstream_keepalive)
Please sign in to comment.
Something went wrong with that request. Please try again.