Am Dienstag, 24. Juli 2018, 10:20:01 CEST schrieb Ginhoux, Patrick:
I run Kamailio 5.0.1 with MariaDB database.
There is no issue at the initialization, meaning the db is opened by kamailio and the hash tables loaded from the db tables.
Hello Patrick,
this is strange. Normally if it can initialize correctly during startup, then it also should be able to use the database later on.
I did a quick check of the htable module in the repository. There have been a few fixes related to rpc commands and also a bit related to the database in the last year. But I did not saw from the git logs anything like you described.
Nevertheless, you should try to setup the latest 5.0 release (5.0.7) - maybe on a test system and see if the error is also happening there. There should be no changes in database or configuration comparing to 5.0.1.
Best regards,
Henning
Example:
# kamcmd htable.dump propertiesHash [..]
But the htable.reload command fails:
error: 500 - Failed to open htable db connection
The Kamailio log reports that it can't connect the db :
DEBUG: ctl [../../core/io_wait.h:380]: io_watch_add(): DBG: io_watch_add(0x7f68c74ab300, 10, 3, 0xdc9410), fd_no=1
DEBUG: ctl [io_listener.c:442]: handle_new_connect(): handle_stream read: new connection (1) on /var/run/kamailio//kamailio_ctl
DEBUG: <core> [core/sr_module.c:694]: find_mod_export_record(): find_export_record: found <db_bind_api> in module db_mysql [/usr/lib64/kamailio/modules/db_mysql.so]
DEBUG: <core> [db.c:209]: db_bind_mod(): using db bind api for db_mysql
DEBUG: <core> [db.c:314]: db_do_init2(): connection 0x7f68cc354c10 not found in pool
DEBUG: db_mysql [km_my_con.c:98]: db_mysql_new_connection(): opening connection: mysql://xxxx:xxxx@/siprouter
ERROR: db_mysql [km_my_con.c:124]: db_mysql_new_connection(): driver error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
ERROR: <core> [db.c:318]: db_do_init2(): could not add connection to the pool
ERROR: htable [ht_db.c:92]: ht_db_open_con(): failed to connect to the database
My local db is located at /myqdata/mysiprdb/data where is the mysiprdb.sock file. But the log shows that Kamailio is looking for /var/lib/mysql/mysql.sock.
Does this error make sense to you ?
Is it possible to fix this problem by configuration in Kamailio ?
My kamailio.cfg script contains :
# ----- htable
modparam("htable", "db_url", "mysql://[kamailio]/siprouter")
modparam("htable", "fetch_rows", 1000)
modparam("htable", "htable", "mbxrangeHash=>size=4;dbtable=mbxrange;")
modparam("htable", "htable", "abpqHash=>size=12;dbtable=abpq;")
modparam("htable", "htable", "zabpqHash=>size=12;dbtable=zabpq;")
modparam("htable", "htable", "propertiesHash=>size=4;dbtable=properties;")
In the /myqdata/mysiprdb/data/my.cnf, I added the following entries for Kamailio:
[kamailio]
socket = /myqdata/mysiprdb/data/mysiprdb.sock
user = siprouter
password = ##########
default-character-set = utf8
Thanks all for help.
Cordialement.
Patrick GINHOUX