Module: sip-router
Branch: master
Commit: b7fde2349a28e22cd9e02412d914d07ee8654f79
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b7fde23…
Author: Anca Vamanu <anca.vamanu(a)1and1.ro>
Committer: Anca Vamanu <anca.vamanu(a)1and1.ro>
Date: Wed Jan 9 14:19:06 2013 +0200
db_cassandra: Improved documentation and config file example
---
modules/db_cassandra/README | 41 ++++++++++++++----
modules/db_cassandra/dbcassa_base.cpp | 2 +-
modules/db_cassandra/doc/db_cassandra_admin.xml | 51 +++++++++++++++++++----
modules/db_cassandra/kamailio_cassa.cfg | 2 +-
4 files changed, 76 insertions(+), 20 deletions(-)
diff --git a/modules/db_cassandra/README b/modules/db_cassandra/README
index d9b955b..5ba9e4b 100644
--- a/modules/db_cassandra/README
+++ b/modules/db_cassandra/README
@@ -207,7 +207,8 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
* Third row: the columns that form the secondary key separated by
space.
- Bellow you can see the schema for the location table:
+ Bellow you can see the schema for the location table (when use_domain
+ not set):
...
callid(string) cflags(int) contact(string) cseq(int) expires(timestamp) flags
@@ -219,10 +220,23 @@ eg_id(int)
...
Observe first that the row key is the username and the secondary index
- is the contact. We have also defined a timestamp column - expires. In
- this example, both the row key and the secondary index are defined by
- only one column, but they can be formed out of more columns. You can
- list them separated by space.
+ is the contact. We have also defined a timestamp column - expires.
+
+ If you need to use the domain part of the AOR also (you have set
+ use_domain parameter for usrloc in the script), you should include the
+ domain column in the list of columns and in the primary key. The schema
+ will then look like this:
+ ...
+ callid(string) cflags(int) contact(string) cseq(int) domain(string) expires(t
+imestamp) flags(int) last_modified(int) methods(int) path(string) q(double) rece
+ived(string) socket(string) user_agent(string) username(string) ruid(string) ins
+tance(string) reg_id(int)
+ username domain
+ contact
+ ...
+
+ Notice that a key (primary or secondary) can be composed from more
+ columns, in which case you have to specify them separated by space.
To understand why the schema looks like this, we must first see which
queries are performed on the location table. (The 'callid' condition
@@ -239,16 +253,25 @@ eg_id(int)
secondary keys.
The timestamp column that leaves the Cassandra cluster to deal with
- deleting expired record can be used only with a modification to the
- usrloc module that replaces the update performed at re-registration
- with an insert operation (so that all columns are updated). This
- behavior can be enabled by setting a parameter in the usrloc module
+ deleting the expired records. For this to work right we needed to
+ modify a bit the behavior of usrloc module and replace update sql query
+ performed at re-registration with an insert sql query (so that all
+ columns are updated and the new timestamp is set for all columns). This
+ behavior is enabled by setting a parameter in the usrloc module
db_update_as_insert:
...
modparam("usrloc", "db_update_as_insert", 1)
...
+ Also you should disable in usrloc module the timer routine that checks
+ for expired records. You can do this by setting the timer interval to
+ 0. timer_interval:
+
+ ...
+ modparam("usrloc", "timer_interval", 0)
+ ...
+
The alternative would have been to define an index on the expire column
and run a external job to periodically delete the expired records.
However, obviously, this would be more costly.
diff --git a/modules/db_cassandra/dbcassa_base.cpp b/modules/db_cassandra/dbcassa_base.cpp
index dfbf58f..e9d3a32 100644
--- a/modules/db_cassandra/dbcassa_base.cpp
+++ b/modules/db_cassandra/dbcassa_base.cpp
@@ -359,7 +359,7 @@ int cassa_constr_key( const db_key_t* _k, const db_val_t* _v,
break;
}
if(j == _n) {
- LM_ERR("The key column with name [%.*s] not found in values\n", key_array[i]->name.len, key_array[i]->name.s);
+ LM_DBG("The key column with name [%.*s] not found in values\n", key_array[i]->name.len, key_array[i]->name.s);
break;
}
pk= dbval_to_string(_v[j], pk);
diff --git a/modules/db_cassandra/doc/db_cassandra_admin.xml b/modules/db_cassandra/doc/db_cassandra_admin.xml
index c0b3f86..0a05914 100644
--- a/modules/db_cassandra/doc/db_cassandra_admin.xml
+++ b/modules/db_cassandra/doc/db_cassandra_admin.xml
@@ -227,7 +227,8 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
</itemizedlist>
</para>
<para>
- Bellow you can see the schema for the <emphasis>location</emphasis> table:
+ Bellow you can see the schema for the <emphasis>location</emphasis>
+ table (when use_domain not set):
</para>
<para>
</para>
@@ -241,13 +242,30 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
</programlisting>
<para>
- Observe first that the <emphasis>row key is the username</emphasis> and the <emphasis>secondary index is the contact</emphasis>.
+ Observe first that the <emphasis>row key is the username</emphasis> and
+ the <emphasis>secondary index is the contact</emphasis>.
We have also defined a timestamp column - <emphasis>expires</emphasis>.
- In this example, both the row key and the secondary index are defined by only one column,
- but they can be formed out of more columns. You can list them separated by space.
</para>
<para>
+ If you need to use the domain part of the AOR also (you have set use_domain
+ parameter for usrloc in the script), you should include the domain column in
+ the list of columns and in the primary key. The schema will then look like this:
+ </para>
+
+<programlisting format="linespecific">
+ ...
+ callid(string) cflags(int) contact(string) cseq(int) domain(string) <emphasis>expires(timestamp)</emphasis> flags(int) last_modified(int) methods(int) path(string) q(double) received(string) socket(string) user_agent(string) username(string) ruid(string) instance(string) reg_id(int)
+ <emphasis>username domain</emphasis>
+ <emphasis>contact</emphasis>
+ ...
+</programlisting>
+
+ <para>
+ Notice that a key (primary or secondary) can be composed from more columns,
+ in which case you have to specify them separated by space.
+ </para>
+ <para>
To understand why the schema looks like this, we must first see which
queries are performed on the location table.
(The 'callid' condition was ignored as it doesn't really have a well defined role in the SIP RFC).
@@ -281,11 +299,11 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
</listitem>
</itemizedlist>
<para>
- The timestamp column that leaves the Cassandra cluster to deal with deleting expired
- record can be used only with a modification to the usrloc module that replaces the
- update performed at re-registration with an insert operation (so that all columns
- are updated).
- This behavior can be enabled by setting a parameter in the usrloc module
+ The timestamp column that leaves the Cassandra cluster to deal with deleting the expired
+ records. For this to work right we needed to modify a bit the behavior of usrloc module and
+ replace update sql query performed at re-registration with an insert sql query (so that all
+ columns are updated and the new timestamp is set for all columns).
+ This behavior is enabled by setting a parameter in the usrloc module
<emphasis>db_update_as_insert</emphasis>:
</para>
<para>
@@ -298,6 +316,21 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
</programlisting>
<para>
+ Also you should disable in usrloc module the timer routine that checks for expired records.
+ You can do this by setting the timer interval to 0.
+ <emphasis>timer_interval</emphasis>:
+ </para>
+ <para>
+ </para>
+
+<programlisting format="linespecific">
+ ...
+ modparam("usrloc", "timer_interval", 0)
+ ...
+</programlisting>
+
+
+ <para>
The alternative would have been to define an index on the expire column and
run a external job to periodically delete the expired records. However,
obviously, this would be more costly.
diff --git a/modules/db_cassandra/kamailio_cassa.cfg b/modules/db_cassandra/kamailio_cassa.cfg
index 69bad70..d0b97e4 100644
--- a/modules/db_cassandra/kamailio_cassa.cfg
+++ b/modules/db_cassandra/kamailio_cassa.cfg
@@ -313,6 +313,7 @@ modparam("acc", "db_extra",
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 3)
modparam("usrloc", "db_update_as_insert", 1)
+modparam("usrloc", "timer_interval", 0)
#modparam("usrloc", "use_domain", MULTIDOMAIN)
@@ -323,7 +324,6 @@ modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "")
#modparam("auth_db", "use_domain", MULTIDOMAIN)
-modparam("auth_db", "use_domain", 1)
# ----- permissions params -----
#!ifdef WITH_IPAUTH
Module: sip-router
Branch: master
Commit: ff18475e9fd3c6d4da4ca2e85c045fc761eb48e5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ff18475…
Author: Anca Vamanu <anca.vamanu(a)1and1.ro>
Committer: Anca Vamanu <anca.vamanu(a)1and1.ro>
Date: Wed Jan 9 15:44:38 2013 +0200
db_cassandra: updated documentation
- added URLs for Thrift library and Cassandra
---
modules/db_cassandra/README | 7 +++++--
modules/db_cassandra/doc/db_cassandra_admin.xml | 9 +++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/modules/db_cassandra/README b/modules/db_cassandra/README
index 5ba9e4b..97df44e 100644
--- a/modules/db_cassandra/README
+++ b/modules/db_cassandra/README
@@ -142,9 +142,12 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
The following libraries or applications must be installed before
running SIP Router with this module loaded:
- * Thrift library version 0.6.1 .
+ * Thrift library (tested with version 0.6.1 and version 0.7.0). You
+ can download it from http://archive.apache.org/dist/thrift .
- The implementation was tested with Cassandra version 1.0.1 .
+ The implementation was tested with Cassandra version 1.0.1 and version
+ 1.1.6. I used the sourced from DataStax Community Edition
+ (http://www.datastax.com/download/community).
3. Parameters
diff --git a/modules/db_cassandra/doc/db_cassandra_admin.xml b/modules/db_cassandra/doc/db_cassandra_admin.xml
index 0a05914..d52c907 100644
--- a/modules/db_cassandra/doc/db_cassandra_admin.xml
+++ b/modules/db_cassandra/doc/db_cassandra_admin.xml
@@ -122,12 +122,17 @@ default_validation_class='UTF8Type' and key_validation_class='UTF8Type';
<itemizedlist>
<listitem>
<para>
- <emphasis>Thrift library</emphasis> version 0.6.1 .
+ <emphasis>Thrift library</emphasis>
+ (tested with version 0.6.1 and version 0.7.0).
+ You can download it from http://archive.apache.org/dist/thrift .
</para>
</listitem>
</itemizedlist>
</para>
- <para> The implementation was tested with Cassandra version 1.0.1 .</para>
+ <para> The implementation was tested with Cassandra version 1.0.1
+ and version 1.1.6. I used the sourced from DataStax Community
+ Edition (http://www.datastax.com/download/community).
+ </para>
</section>
</section>
Hi,
I've been looking at experimenting with the Cassandra module, but I have
noticed that the domain column seems to be missing from the location
table. Is this an oversight, or have I misunderstood something?
Regards,
Peter
--
Peter Dunkley
Technical Director
Crocodile RCS Ltd
Hello,
The README for the Cassandra module says it was tested with the domain
module, but there is no file for this in utils/kamctl/dbcassandra.
Should there be one?
What should the row key and secondary key for the domain module be?
Thanks,
Peter
--
Peter Dunkley
Technical Director
Crocodile RCS Ltd
Hello,
to avoid getting extra commit notification as "Merge branch 'master' of
...", do next command before pushing commits to remote repository:
git pull --ff --rebase origin master
The notification results when someone else committed in between the
moment you pulled last time the repository and the push. A rebase will
make all notification clean.
Cheers,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Hello,
I'm writing to see if anyone has some spare time to take care of
renaming from openser to kamailio in perl and snmpstats modules. I
assume is more like search and replace, but has to be carefully done to
be coherent and not break stuff there, so it might be a bit more than a
sed command.
The IANA enterprise number in MIBs is already the one for kamailio.org
Thanks,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda