|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
<chapter>
|
|
<chapter>
|
|
<title>&adminguide;</title>
|
|
<title>&adminguide;</title>
|
|
- <section>
|
|
|
|
|
|
+ <section id="db_redis.sec.overview">
|
|
<title>Overview</title>
|
|
<title>Overview</title>
|
|
<para>
|
|
<para>
|
|
This module provides a DB APIv1 connector for the Redis server (<ulink url="https://www.redis.io">https://www.redis.io</ulink>).
|
|
This module provides a DB APIv1 connector for the Redis server (<ulink url="https://www.redis.io">https://www.redis.io</ulink>).
|
|
@@ -26,8 +26,8 @@
|
|
</para>
|
|
</para>
|
|
<para>
|
|
<para>
|
|
Since Redis does not provide a schema by itself, db_redis ships with
|
|
Since Redis does not provide a schema by itself, db_redis ships with
|
|
- schema files. The path to these has to be defined using the module parameter
|
|
|
|
- "schema_path". The schema definition is defined in one file per table, such that
|
|
|
|
|
|
+ schema files. The path to these has to be defined using the module parameter
|
|
|
|
+ "schema_path". The schema definition is defined in one file per table, such that
|
|
the file name corresponds to the table name, and each file is composed of a
|
|
the file name corresponds to the table name, and each file is composed of a
|
|
comma-separated list of column definitions in the format
|
|
comma-separated list of column definitions in the format
|
|
<column-name>/<type>[,<column-name>/<type> ...]
|
|
<column-name>/<type>[,<column-name>/<type> ...]
|
|
@@ -42,15 +42,15 @@ username/string,domain/string,contact/string,received/string,path/string,expires
|
|
</para>
|
|
</para>
|
|
<para>
|
|
<para>
|
|
Because Redis is a key-value store, it requires unique keys. This means
|
|
Because Redis is a key-value store, it requires unique keys. This means
|
|
- that tables and rows from a relational SQL database, e.g. from MySQL, can
|
|
|
|
|
|
+ that tables and rows from a relational SQL database, e.g. from MySQL, can
|
|
not be ported one a 1:1 basis to Redis.
|
|
not be ported one a 1:1 basis to Redis.
|
|
</para>
|
|
</para>
|
|
<para>
|
|
<para>
|
|
For instance, usrloc relies on a key of "username@domain", but in order to store
|
|
For instance, usrloc relies on a key of "username@domain", but in order to store
|
|
- multiple contacts per AoR, it cannot be constrained to uniqueness. To
|
|
|
|
|
|
+ multiple contacts per AoR, it cannot be constrained to uniqueness. To
|
|
work around this, db_redis supports mapping sets in such a way as to, in the case of
|
|
work around this, db_redis supports mapping sets in such a way as to, in the case of
|
|
- the usrloc module, have a set with a key of "username@domain" and its entries being
|
|
|
|
- unique keys per contact based on the ruid of a contact. Thus, one contact in usrloc
|
|
|
|
|
|
+ the usrloc module, have a set with a key of "username@domain" and its entries being
|
|
|
|
+ unique keys per contact based on the ruid of a contact. Thus, one contact in usrloc
|
|
consists of a unique key "location:entry::example-ruid-1" being a hash with the columns like
|
|
consists of a unique key "location:entry::example-ruid-1" being a hash with the columns like
|
|
username, domain, contact, path etc. In addition, this unique key is stored
|
|
username, domain, contact, path etc. In addition, this unique key is stored
|
|
in a set "location:usrdom::exampleuser:exampledomain.org". When usrloc does
|
|
in a set "location:usrdom::exampleuser:exampledomain.org". When usrloc does
|
|
@@ -89,7 +89,7 @@ location=entry:ruid&usrdom:username,domain&timer:partition,keepalive;acc
|
|
</programlisting>
|
|
</programlisting>
|
|
</para>
|
|
</para>
|
|
<para>
|
|
<para>
|
|
- For readability purposes, definitions of keys per table can span multiple Kamailio
|
|
|
|
|
|
+ For readability purposes, definitions of keys per table can span multiple Kamailio
|
|
config lines by providing multiple "keys" modparams.
|
|
config lines by providing multiple "keys" modparams.
|
|
</para>
|
|
</para>
|
|
</section>
|
|
</section>
|
|
@@ -102,7 +102,7 @@ location=entry:ruid&usrdom:username,domain&timer:partition,keepalive;acc
|
|
This module has implemented equivalent underlying Redis operations for INSERT,
|
|
This module has implemented equivalent underlying Redis operations for INSERT,
|
|
UPDATE, DELETE and SELECT. The ORDER BY clause for SELECT is not implemented.
|
|
UPDATE, DELETE and SELECT. The ORDER BY clause for SELECT is not implemented.
|
|
Raw querying is not implemented inside this module; for sending literal commands
|
|
Raw querying is not implemented inside this module; for sending literal commands
|
|
- to the Redis server, use ndb_redis.
|
|
|
|
|
|
+ to the Redis server, use ndb_redis.
|
|
</para>
|
|
</para>
|
|
</listitem>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</itemizedlist>
|
|
@@ -123,54 +123,84 @@ location=entry:ruid&usrdom:username,domain&timer:partition,keepalive;acc
|
|
</itemizedlist>
|
|
</itemizedlist>
|
|
</para>
|
|
</para>
|
|
</section>
|
|
</section>
|
|
|
|
+ <section>
|
|
|
|
+ <title>External Libraries or Applications</title>
|
|
|
|
+ <para>
|
|
|
|
+ The following libraries or applications must be installed before running
|
|
|
|
+ &kamailio; with this module loaded:
|
|
|
|
+ <itemizedlist>
|
|
|
|
+ <listitem>
|
|
|
|
+ <para>
|
|
|
|
+ <emphasis>hiredis</emphasis> - available at
|
|
|
|
+ <ulink url="https://github.com/redis/hiredis">https://github.com/redis/hiredis</ulink>
|
|
|
|
+ </para>
|
|
|
|
+ </listitem>
|
|
|
|
+ </itemizedlist>
|
|
|
|
+ </para>
|
|
|
|
+ </section>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
<section>
|
|
<section>
|
|
<title>Parameters</title>
|
|
<title>Parameters</title>
|
|
- <section>
|
|
|
|
|
|
+ <section id="db_redis.p.schema_path">
|
|
<title><varname>schema_path</varname> (string)</title>
|
|
<title><varname>schema_path</varname> (string)</title>
|
|
<para>
|
|
<para>
|
|
- The path to the table schemas (default /usr/share/kamailio/db_redis).
|
|
|
|
|
|
+ The path to the table schemas.
|
|
|
|
+ </para>
|
|
|
|
+ <para>
|
|
|
|
+ Default value: "/usr/share/kamailio/db_redis".
|
|
</para>
|
|
</para>
|
|
<example>
|
|
<example>
|
|
<title>Setting schema_path module parameter</title>
|
|
<title>Setting schema_path module parameter</title>
|
|
<programlisting format="linespecific">
|
|
<programlisting format="linespecific">
|
|
|
|
+...
|
|
modparam("db_redis", "schema_path", "/usr/local/share/kamailio/db_redis/kamailio")
|
|
modparam("db_redis", "schema_path", "/usr/local/share/kamailio/db_redis/kamailio")
|
|
|
|
+...
|
|
</programlisting>
|
|
</programlisting>
|
|
</example>
|
|
</example>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
- <section>
|
|
|
|
|
|
+ <section id="db_redis.p.keys">
|
|
<title><varname>keys</varname> (string)</title>
|
|
<title><varname>keys</varname> (string)</title>
|
|
<para>
|
|
<para>
|
|
The entry and mapping keys of tables.
|
|
The entry and mapping keys of tables.
|
|
</para>
|
|
</para>
|
|
|
|
+ <para>
|
|
|
|
+ Default value: "" (empty).
|
|
|
|
+ </para>
|
|
<example>
|
|
<example>
|
|
<title>Setting keys module parameter</title>
|
|
<title>Setting keys module parameter</title>
|
|
<programlisting format="linespecific">
|
|
<programlisting format="linespecific">
|
|
|
|
+...
|
|
modparam("db_redis", "keys", "version=entry:table_name;location=entry:ruid&usrdom:username,domain&timer:partition,keepalive")
|
|
modparam("db_redis", "keys", "version=entry:table_name;location=entry:ruid&usrdom:username,domain&timer:partition,keepalive")
|
|
|
|
+...
|
|
|
|
+ </programlisting>
|
|
|
|
+ </example>
|
|
|
|
+ </section>
|
|
|
|
+
|
|
|
|
+ <section id="db_redis.p.verbosity">
|
|
|
|
+ <title><varname>verbosity</varname> (int)</title>
|
|
|
|
+ <para>
|
|
|
|
+ Control the verbosity of debug messages printed by the module.
|
|
|
|
+ If set to 1, the module prints schema details for all tables
|
|
|
|
+ on each connect operation to Redis server.
|
|
|
|
+ </para>
|
|
|
|
+ <para>
|
|
|
|
+ Default value: 1.
|
|
|
|
+ </para>
|
|
|
|
+ <example>
|
|
|
|
+ <title>Setting verbosity module parameter</title>
|
|
|
|
+ <programlisting format="linespecific">
|
|
|
|
+...
|
|
|
|
+modparam("db_redis", "verbosity", 0)
|
|
|
|
+...
|
|
</programlisting>
|
|
</programlisting>
|
|
</example>
|
|
</example>
|
|
</section>
|
|
</section>
|
|
- </section>
|
|
|
|
|
|
|
|
- <section>
|
|
|
|
- <title>External Libraries or Applications</title>
|
|
|
|
- <para>
|
|
|
|
- The following libraries or applications must be installed before running
|
|
|
|
- &kamailio; with this module loaded:
|
|
|
|
- <itemizedlist>
|
|
|
|
- <listitem>
|
|
|
|
- <para>
|
|
|
|
- <emphasis>hiredis</emphasis> - available at
|
|
|
|
- <ulink url="https://github.com/redis/hiredis">https://github.com/redis/hiredis</ulink>
|
|
|
|
- </para>
|
|
|
|
- </listitem>
|
|
|
|
- </itemizedlist>
|
|
|
|
- </para>
|
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
- <section>
|
|
|
|
|
|
+ <section id="db_redis.sec.usage">
|
|
<title>Usage</title>
|
|
<title>Usage</title>
|
|
<para>
|
|
<para>
|
|
Load the module and set the "db_url" modparam for specific modules to:
|
|
Load the module and set the "db_url" modparam for specific modules to:
|
|
@@ -227,7 +257,7 @@ HMSET address:entry::4 id 4 grp 2 ip_addr "127.0.0.4" mask 32 port 0 tag "test"
|
|
</section>
|
|
</section>
|
|
|
|
|
|
<section>
|
|
<section>
|
|
- <title>Module specific considerations</title>
|
|
|
|
|
|
+ <title>Module Specific Considerations</title>
|
|
<section>
|
|
<section>
|
|
<title>usrloc</title>
|
|
<title>usrloc</title>
|
|
<para>
|
|
<para>
|