We have two kamailio in load balancing, mysql is in cluster mode with galera. We need to use sca, but kamailio db_cluster is not supported (i need to specify connection string to sql not cluster name) and if phone1 is registered on kamailio1 and phone2 on kamailio2, sca not work. It is possibile to implement cluster?
Are you perhaps getting Kamailo's db_cluster module confused with Galara's clustering? Kamailio's db_cluster module works as an abstraction for SQL connections - there's no explicit technical need for the actual DBs in the connection to be synchronized (you almost certainly would WANT them to be synchronized, but the module itself doesn't care). I have several situations where I connect to multiple SQL replicas (in some cases mysql, in other cases postgres) with the intent that there is a primary and secondary DB. This is just basic SQL replication. The Kamailio config looks like this:
## Define all of the individual connections for the cluster: modparamx( "db_cluster", "connection", "primary=>mysql://$def(DB_USER):$def(DB_PASS)@$def(DB_HOST)/$def(DB_DATABASE)" ) modparamx( "db_cluster", "connection", "secondary=>mysql://$def(DB_USER):$def(DB_PASS)@$def(DB_BAK_HOST)/$def(DB_DATABASE)" )
## Define the cluster. List each connection and its priorities. In this ## case the reads preferring primary (9s), but will fall back to the secondary ## and the writes are ONLY to the primary: modparam("db_cluster", "cluster", "db=>primary=9s9s;secondary=8s0s")
## Use the DB cluster anywhere a "db_url" mod param is used: modparam("permissions", "db_url", "cluster://db");
I'm not using the sca module, but it has a db_url parameter, and I would expect it could be used exactly like this. If this is what you're doing and it's not working, what error are you getting?
Kaufman
Senior Voice Engineer
E: bkaufman@bcmone.com
SIP.US Client Support: 800.566.9810 | SIPTRUNK Client Support: 800.250.6510 | Flowroute Client Support: 855.356.9768
[img]https://www.sip.us [img]https://www.siptrunk.com [img]https://www.flowroute.com
________________________________ From: mauro.celli76--- via sr-users sr-users@lists.kamailio.org Sent: Thursday, May 29, 2025 7:11 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: mauro.celli76@gmail.com mauro.celli76@gmail.com Subject: [SR-Users] Sca in cluster/load balancer
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
We have two kamailio in load balancing, mysql is in cluster mode with galera. We need to use sca, but kamailio db_cluster is not supported (i need to specify connection string to sql not cluster name) and if phone1 is registered on kamailio1 and phone2 on kamailio2, sca not work. It is possibile to implement cluster? __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Mauro,
Please send replies to the list, not to individual users.
* Note, i use ast=>cluster://kamailio in other modules without problem…
In which modules do you use that syntax? It would be correct for sqlops' sqlcon parameter, where you're defining connections, but it's not consistent with any of the documentation, and moreover the error show indicates that it's trying to read the beginning of your string as the db module to use (Module db_ast=>cluster not found). Try with:
modparam( "sca", "db_url", "cluster://kamailio")
Regards, Kaufman
________________________________ From: Mauro Celli mauro.celli76@gmail.com
With this work modparam( "sca", "db_url", "mysql://xxx:xxx@x.x.x.x/kamailio_cluster1")
With this
modparam("db_cluster", "connection","a1=>mysql://xxx:xxx@x.x.x.x/asterisk_cluster1") modparam("db_cluster", "connection","a2=>mysql://xxx:xxx@x.x.x.x/asterisk_cluster1") modparam("db_cluster", "connection","a3=>mysql://xxx:xxx@x.x.x.x/asterisk_cluster1") modparam("db_cluster", "cluster", "kamailio=>a1=9r9p;a2=9r9p;a3=9r9p") modparam( "sca", "db_url", "ast=>cluster://kamailio")
the error is
kamailio | 0(7) ERROR: <core> [lib/srdb1/db.c:212]: db_bind_mod(): Module db_ast=>cluster not found. Missing loadmodule? kamailio | 0(7) ERROR: sca [sca.c:223]: sca_bind_srdb1(): Failed to initialize required DB API - ast=>cluster://kamailio kamailio | 0(7) ERROR: sca [sca.c:409]: sca_mod_init(): Failed to initialize required DB API kamailio | 0(7) ERROR: <core> [core/sr_module.c:1040]: init_mod(): Error while initializing module sca (/usr/lib/x86_64-linux-gnu/kamailio/modules/sca.so)
Note, i use ast=>cluster://kamailio in other modules without problem…
This is only the first problem, the second is: if i have two phones, registered in different kamailio, sca module not send notify to phone Thanks
________________________________ From: Ben Kaufman via sr-users sr-users@lists.kamailio.org Sent: Thursday, May 29, 2025 8:41 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: mauro.celli76@gmail.com mauro.celli76@gmail.com; Ben Kaufman bkaufman@bcmone.com Subject: [SR-Users] Re: Sca in cluster/load balancer
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Are you perhaps getting Kamailo's db_cluster module confused with Galara's clustering? Kamailio's db_cluster module works as an abstraction for SQL connections - there's no explicit technical need for the actual DBs in the connection to be synchronized (you almost certainly would WANT them to be synchronized, but the module itself doesn't care). I have several situations where I connect to multiple SQL replicas (in some cases mysql, in other cases postgres) with the intent that there is a primary and secondary DB. This is just basic SQL replication. The Kamailio config looks like this:
## Define all of the individual connections for the cluster: modparamx( "db_cluster", "connection", "primary=>mysql://$def(DB_USER):$def(DB_PASS)@$def(DB_HOST)/$def(DB_DATABASE)" ) modparamx( "db_cluster", "connection", "secondary=>mysql://$def(DB_USER):$def(DB_PASS)@$def(DB_BAK_HOST)/$def(DB_DATABASE)" )
## Define the cluster. List each connection and its priorities. In this ## case the reads preferring primary (9s), but will fall back to the secondary ## and the writes are ONLY to the primary: modparam("db_cluster", "cluster", "db=>primary=9s9s;secondary=8s0s")
## Use the DB cluster anywhere a "db_url" mod param is used: modparam("permissions", "db_url", "cluster://db");
I'm not using the sca module, but it has a db_url parameter, and I would expect it could be used exactly like this. If this is what you're doing and it's not working, what error are you getting?
Kaufman
Senior Voice Engineer
E: bkaufman@bcmone.com
SIP.US Client Support: 800.566.9810 | SIPTRUNK Client Support: 800.250.6510 | Flowroute Client Support: 855.356.9768
[img]https://urldefense.com/v3/__https://www.sip.us__;!!KWzduNI!bJcF2Q2te41Fdhxbmogg7Tnfv6ve9i5Etdz5Spq4VgCGGCkbT6AQzQHUSY6lmVtzp77i0UmfsYnGbX-7tHDnp2w$ [img]https://urldefense.com/v3/__https://www.siptrunk.com__;!!KWzduNI!bJcF2Q2te41Fdhxbmogg7Tnfv6ve9i5Etdz5Spq4VgCGGCkbT6AQzQHUSY6lmVtzp77i0UmfsYnGbX-777x2Fss$ [img]https://www.flowroute.com
________________________________ From: mauro.celli76--- via sr-users sr-users@lists.kamailio.org Sent: Thursday, May 29, 2025 7:11 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: mauro.celli76@gmail.com mauro.celli76@gmail.com Subject: [SR-Users] Sca in cluster/load balancer
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
We have two kamailio in load balancing, mysql is in cluster mode with galera. We need to use sca, but kamailio db_cluster is not supported (i need to specify connection string to sql not cluster name) and if phone1 is registered on kamailio1 and phone2 on kamailio2, sca not work. It is possibile to implement cluster? __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Thanks! Work! Now, is there a way to get the module to work on a kamailio cluster? I don't see anything in the documentation...
I think what you're looking for is to have one Kamailio server be able to write presence information into a database, and have other kamailio servers detect those change and send NOTIFY messages, and I don't think that this will work in that manner based on the documentation:
* The call-info subscriber information is stored in memory and is periodically written to the database. Call state information is stored in memory. A future release may periodically write call state to the database, as well. The database is purely for restoring subscriptions after a restart of the application server. Subscriber information is also flushed to the database when the service is stopped.
There are probably other ways of getting what you want here, like maintaining subscriber information in memory on each individual host (you don't want to send NOTIFY from each server to a single UA for every event, right?), and replicating call state information via DMQ to trigger the notifications. But that's just a quick guess.
Regards, Kaufman
Kaufman Senior Voice Engineer
E: bkaufman@bcmone.com
SIP.US Client Support: 800.566.9810 | SIPTRUNK Client Support: 800.250.6510 | Flowroute Client Support: 855.356.9768
[img]https://www.sip.us [img]https://www.siptrunk.com [img]https://www.flowroute.com
________________________________ From: mauro.celli76--- via sr-users sr-users@lists.kamailio.org Sent: Thursday, May 29, 2025 9:25 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: mauro.celli76@gmail.com mauro.celli76@gmail.com Subject: [SR-Users] Re: Sca in cluster/load balancer
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Thanks! Work! Now, is there a way to get the module to work on a kamailio cluster? I don't see anything in the documentation... __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Did you try DMQ?
Regards,
David Villasmil email: david.villasmil.work@gmail.com
On Thu, May 29, 2025 at 5:15 PM Ben Kaufman via sr-users < sr-users@lists.kamailio.org> wrote:
I think what you're looking for is to have one Kamailio server be able to write presence information into a database, and have *other* kamailio servers detect those change and send NOTIFY messages, and I don't think that this will work in that manner based on the documentation:
- The call-info subscriber information is stored in memory and is
periodically written to the database. Call state information is stored in memory. A future release may periodically write call state to the database, as well. The database is purely for restoring subscriptions after a restart of the application server. Subscriber information is also flushed to the database when the service is stopped.
There are probably other ways of getting what you want here, like maintaining subscriber information in memory on each individual host (you don't want to send NOTIFY from each server to a single UA for every event, right?), and replicating call state information via DMQ to trigger the notifications. But that's just a quick guess.
Regards, Kaufman
*Kaufman*
*Senior Voice Engineer *
E: bkaufman@bcmone.com
SIP.US Client Support: 800.566.9810 *|* SIPTRUNK Client Support: 800.250.6510 *|* Flowroute Client Support: 855.356.9768 [image: img] https://www.sip.us [image: img] https://www.siptrunk.com *[image: img] https://www.flowroute.com*
*From:* mauro.celli76--- via sr-users sr-users@lists.kamailio.org *Sent:* Thursday, May 29, 2025 9:25 AM
*To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Cc:* mauro.celli76@gmail.com mauro.celli76@gmail.com *Subject:* [SR-Users] Re: Sca in cluster/load balancer
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Thanks! Work! Now, is there a way to get the module to work on a kamailio cluster? I don't see anything in the documentation... __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!