[SR-Users] Kamailio : kamctl address reload with HAProxy

Paclinio thomas.leutscher at gmail.com
Mon Mar 28 13:51:00 CEST 2022


Hello,

*KAMCTL :*

I've resolved the problem with kamctl that now can communicate with my
remote Cluster by adding this line in kamctlrc. But Kamailio doesn't start.

// HAPROXY = 192.168.1.37

DBHOST=192.168.1.37
>
DBACCESSHOST=192.168.1.37


I can now add and reload new addresses with success.

*KAMAILIO + HAPROXY:*

But now, I've this issue when restarting kamailio.

Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: permissions
> [address.c:233]: reload_address_db_table(): database problem - invalid
> record
> Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: permissions
> [permissions.c:657]: mod_init(): failed to initialize the allow_address
> function
> Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: <core>
> [core/sr_module.c:942]: init_mod(): Error while initializing module
> permissions (/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so)
>

My DBURL is

#!substdef "!DB_USER!kamailio!g"
> #!substdef "!DB_PASS!XXXXX!g"
> #!substdef "!DB_HOST!192.168.1.37!g"      // HA PROXY
> #!substdef "!DB_PORT!MY_PORT_DB!g"
> #!substdef "!DB_NAME!kamailio!g"
>


> #!define DBURL "mysql://DB_USER:DB_PASS@DB_HOST/DB_NAME"


*KAMAILIO + REMOTE DB :*

Even I using a remote database I'm getting the same issue.
I've discovered the connection between kamailio and remote database is
aborded instantly after restarting kamailio.

Mar 28 11:47:30 db03srv mariadbd[874]: 2022-03-28 11:47:30 44076 [Warning]
> Aborted connection 44076 to db: 'kamailio' user: 'kamailio' host:
> '192.168.1.41' (Got an error reading communication packets)



*RECREATING DATABASE : *

Now I've dropped all my database to recreate a new one by using "kamdbctl
create".
I've GRANT all privileges to my root remote user.

GRANT ALL PRIVILEGES ON *.* TO root at 192.168.1.37 WITH GRANT OPTION;


But I receive this error message when creating.

$ sudo kamdbctl create
> -e \E[37;33mINFO: creating database kamailio ...
> -e \E[37;33mINFO: granting privileges to database kamailio ...
> ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'kamailio'@
> '192.168.1.37'
> ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for
> 'kamailioro'@'192.168.1.37'
> -e \E[37;31mERROR: granting access host privileges to database kamailio
> failed!



Thank you

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Le lun. 28 mars 2022 à 13:34, Henning Westerholt <hw at gilawa.com> a écrit :

> Hello,
>
>
>
> please keep the list in CC – that others can comment as well.
>
>
>
> Can you actually connect from the kamailio system e.g. with mysql client?
> If yes, as I said – I would try to debug the issue further with network
> analysis tools.
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
>
> Kamailio services – https://gilawa.com
>
>
>
> *From:* Paclinio <thomas.leutscher at gmail.com>
> *Sent:* Monday, March 28, 2022 1:11 PM
> *To:* Henning Westerholt <hw at gilawa.com>
> *Subject:* Re: [SR-Users] Kamailio : kamctl address reload with HAProxy
>
>
>
> Hello,
>
>
>
> *KAMCTL :*
>
>
>
> I've resolved the problem with kamctl that now can communicate with my
> remote Cluster by adding this line in kamctlrc.
>
>
>
> // HAPROXY = 192.168.1.37
>
> DBHOST=192.168.1.37
>
> DBACCESSHOST=192.168.1.37
>
>
>
> I can now add and reload new addresses with success.
>
>
>
> *KAMAILIO + HAPROXY:*
>
>
>
> But now, I've this issue when restarting kamailio.
>
>
>
> Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: permissions
> [address.c:233]: reload_address_db_table(): database problem - invalid
> record
> Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: permissions
> [permissions.c:657]: mod_init(): failed to initialize the allow_address
> function
> Mar 28 10:54:39 kamailio /usr/sbin/kamailio[8416]: ERROR: <core>
> [core/sr_module.c:942]: init_mod(): Error while initializing module
> permissions (/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so)
>
>
>
> My DBURL is
>
>
>
> #!substdef "!DB_USER!kamailio!g"
> #!substdef "!DB_PASS!XXXXX!g"
> #!substdef "!DB_HOST!192.168.1.37!g"      // HA PROXY
> #!substdef "!DB_PORT!MY_PORT_DB!g"
> #!substdef "!DB_NAME!kamailio!g"
>
>
>
> #!define DBURL "mysql://DB_USER:DB_PASS@DB_HOST/DB_NAME"
>
>
>
> *KAMAILIO + REMOTE DB :*
>
>
>
> Even I using a remote database I'm getting the same issue.
>
> I've discovered the connection between kamailio and remote database is
> aborded instantly after restarting kamailio.
>
>
>
> Mar 28 11:47:30 db03srv mariadbd[874]: 2022-03-28 11:47:30 44076 [Warning]
> Aborted connection 44076 to db: 'kamailio' user: 'kamailio' host:
> '192.168.1.41' (Got an error reading communication packets)
>
>
>
> Thank you
>
>
>
> [image: Das Bild wurde vom Absender entfernt.]
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> Virus-free. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
>
> Le dim. 27 mars 2022 à 22:52, Henning Westerholt <hw at gilawa.com> a écrit :
>
> Hello,
>
>
>
> it seems the data that gets delivered to the Kamailio is corrupted.
> Analyse it further e.g. with a network trace, wireshark etc..
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
>
> Kamailio services – https://gilawa.com
>
>
>
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> *On Behalf Of *
> Paclinio
> *Sent:* Friday, March 25, 2022 5:22 PM
> *To:* sr-users at lists.kamailio.org
> *Subject:* [SR-Users] Kamailio : kamctl address reload with HAProxy
>
>
>
> Dear colleagues,
>
>
>
> I've installed a Galera cluster with a HAProxy that kamailio interacts
> with.
>
> Kamailio's DBURL is linked to the proxy that will contact the databases.
>
> Kamailio works fine except when I need to reload something from the
> database (Using kamctl).
>
>
>
> When cache and database are the same I receive
>
>
>
> sudo kamctl address reload
> {
>   "jsonrpc":  "2.0",
>   "result": "Reload OK",
>   "id": 13111
> }
>
>
>
> Now when I have something using kamctl, it still works and is replaced on
> all my databases.
>
>
>
> sipsecure at kamailio:~$ sudo kamctl address add 0 192.168.48.15 32 0 Test
> -e \E[37;33mINFO: execute '/sbin/kamctl address reload' to synchronize
> cache and database
>
>
>
>
>
>  Then when i try to reload i receive
>
>
>
> sipsecure at kamailio:~$ sudo kamctl address reload
> {
>   "jsonrpc":  "2.0",
>   "error":  {
>     "code": 500,
>     "message":  "Reload failed."
>   },
>   "id": 13504
> }
>
>
>
> And when I'm going to read my logs to see a error, I only see that little
> sentence
>
>
>
> Mar 25 17:14:40 kamailio /usr/sbin/kamailio[13343]: ERROR: permissions
> [address.c:233]: reload_address_db_table(): database problem - invalid
> record
>
>
>
> Could I have some explanation ?
>
>
>
> Thank you.
>
>
>
>
>
> [image: Das Bild wurde vom Absender entfernt.]
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> Virus-free. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220328/64ecba5e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD2717.jpg
Type: image/jpeg
Size: 823 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220328/64ecba5e/attachment.jpg>


More information about the sr-users mailing list