|
@@ -14,9 +14,13 @@ Vicente Hernando
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
- Copyright © 2011 asipto.com
|
|
|
+Morten Isaksen
|
|
|
|
|
|
- Copyright © 2012 www.systemonenoc.com
|
|
|
+ <[email protected]>
|
|
|
+
|
|
|
+ Copyright © 2011 asipto.com
|
|
|
+
|
|
|
+ Copyright © 2012 www.systemonenoc.com
|
|
|
__________________________________________________________________
|
|
|
|
|
|
Table of Contents
|
|
@@ -33,6 +37,8 @@ Vicente Hernando
|
|
|
|
|
|
3.1. server (str)
|
|
|
3.2. init_without_redis (integer)
|
|
|
+ 3.3. connect_timeout (int)
|
|
|
+ 3.4. cmd_timeout (int)
|
|
|
|
|
|
4. Functions
|
|
|
|
|
@@ -43,8 +49,10 @@ Vicente Hernando
|
|
|
|
|
|
1.1. Set server parameter
|
|
|
1.2. Set init_without_redis parameter
|
|
|
- 1.3. redis_cmd usage
|
|
|
- 1.4. redis_free usage
|
|
|
+ 1.3. Set connect_timeout parameter
|
|
|
+ 1.4. Set cmd_timeout parameter
|
|
|
+ 1.5. redis_cmd usage
|
|
|
+ 1.6. redis_free usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
|
|
|
@@ -60,6 +68,8 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
3.1. server (str)
|
|
|
3.2. init_without_redis (integer)
|
|
|
+ 3.3. connect_timeout (int)
|
|
|
+ 3.4. cmd_timeout (int)
|
|
|
|
|
|
4. Functions
|
|
|
|
|
@@ -95,6 +105,8 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
3.1. server (str)
|
|
|
3.2. init_without_redis (integer)
|
|
|
+ 3.3. connect_timeout (int)
|
|
|
+ 3.4. cmd_timeout (int)
|
|
|
|
|
|
3.1. server (str)
|
|
|
|
|
@@ -117,8 +129,8 @@ Chapter 1. Admin Guide
|
|
|
Example 1.1. Set server parameter
|
|
|
...
|
|
|
modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")
|
|
|
-modparam("ndb_redis", "server", "name=srvX;addr=127.0.0.2;port=6379;db=4;pass=m
|
|
|
-ypassword")
|
|
|
+modparam("ndb_redis", "server", "name=srvX;addr=127.0.0.2;port=6379;db=4;pass=my
|
|
|
+password")
|
|
|
|
|
|
# Unix domain socket
|
|
|
modparam("ndb_redis", "server", "name=srvY;unix=/tmp/redis.sock;db=3")
|
|
@@ -129,19 +141,43 @@ modparam("ndb_redis", "server", "name=srvY;unix=/tmp/redis.sock;db=3")
|
|
|
If set to 1, the module will correctly initialize even if redis is not
|
|
|
available at start up.
|
|
|
|
|
|
- Default value is “0�.
|
|
|
+ Default value is "0".
|
|
|
|
|
|
Example 1.2. Set init_without_redis parameter
|
|
|
...
|
|
|
modparam("ndb_redis", "init_without_redis", 1)
|
|
|
...
|
|
|
|
|
|
+3.3. connect_timeout (int)
|
|
|
+
|
|
|
+ The timeout when connecting to the redis server
|
|
|
+
|
|
|
+ Default value is 1000 ms.
|
|
|
+
|
|
|
+ Example 1.3. Set connect_timeout parameter
|
|
|
+...
|
|
|
+modparam("ndb_redis", "connect_timeout", 500)
|
|
|
+...
|
|
|
+
|
|
|
+3.4. cmd_timeout (int)
|
|
|
+
|
|
|
+ The timeout for each query to the redis server. If the redis server
|
|
|
+ does not reply within the timeout value, the command will fail and
|
|
|
+ kamailio will continue executing the cfg file.
|
|
|
+
|
|
|
+ Default value is 1000 ms.
|
|
|
+
|
|
|
+ Example 1.4. Set cmd_timeout parameter
|
|
|
+...
|
|
|
+modparam("ndb_redis", "cmd_timeout", 500)
|
|
|
+...
|
|
|
+
|
|
|
4. Functions
|
|
|
|
|
|
4.1. redis_cmd(srvname, command, ..., replyid)
|
|
|
4.2. redis_free(replyid)
|
|
|
|
|
|
-4.1. redis_cmd(srvname, command, ..., replyid)
|
|
|
+4.1. redis_cmd(srvname, command, ..., replyid)
|
|
|
|
|
|
Send a command to REDIS server identified by srvname. The reply will be
|
|
|
stored in a local container identified by replyid. All the parameters
|
|
@@ -164,7 +200,7 @@ modparam("ndb_redis", "init_without_redis", 1)
|
|
|
* value[n] - returns value of the nth element. value - returns null
|
|
|
for an array. You need to get each element by index.
|
|
|
|
|
|
- Example 1.3. redis_cmd usage
|
|
|
+ Example 1.5. redis_cmd usage
|
|
|
...
|
|
|
if(redis_cmd("srvN", "INCR cnt", "r")) {
|
|
|
# success - the incremented value is in $redis(r=>value)
|
|
@@ -196,7 +232,7 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-4.2. redis_free(replyid)
|
|
|
+4.2. redis_free(replyid)
|
|
|
|
|
|
Frees data in a previous reply from memory. After this function call,
|
|
|
accessing to a freed replyid returns null value.
|
|
@@ -205,7 +241,7 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
|
|
|
function. When ndb_redis module closes, all pending replies are freed
|
|
|
automatically.
|
|
|
|
|
|
- Example 1.4. redis_free usage
|
|
|
+ Example 1.6. redis_free usage
|
|
|
...
|
|
|
After a redis command call:
|
|
|
redis_cmd("srvN", "INCR cnt", "r");
|