[SR-Users] kamcmd htable.reload propertiesHash problem

Henning Westerholt hw at kamailio.org
Thu Aug 9 21:30:50 CEST 2018


Am Donnerstag, 9. August 2018, 09:51:31 CEST schrieb Ginhoux, Patrick:
> Some update since recent discussions about the changes between 5.0.1 and
> 5.0.7 with Sergey Safarov :

Hello Patrick,

thank you for the update, and great that you figured out the issues. 

> 
> -          The mod_perl module had been introduced by mistake in the 5.0.7
> stream so that new packages are now available (5.0.7-7) without this module,
> packages I use to upgrade my server.

Yes, I saw the commit. Good that its now fixed. Some more comments below.

> -          Once the upgrade done to 5.0.7-7 level, I reported 2 problems :
> 
> o   An error reported by the jsonrpcs module : ERROR: jsonrpcs
> [jsonrpcs_fifo.c:82]: jsonrpc_init_fifo_server(): Failed to change the
> owner/group for /var/run/kamailio/kamailio_rpc_fifo  to 248.248; Operation
> not permitted[1]
> 
> ð  It is fixed now by configuring the USER/GROUP parameters with the correct
> values in the systemd unit file
> 
> o   An error to open the MySQL: ERROR: db_mysql [km_my_con.c:129]:
> 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")
> 
> ð  Initially on my Kamailio with 5.0.1, I had created these 2 symbolic links
> to get the connection to the local MySQL server:
> 
> #Symbolic links for the MySQL to MariaDB change to allow kamailio to locate
> the mysql libs and then open the siprouter database
> 
> ln -s /opt/mysql/na/10.2.14/lib64/libmysqlclient.so.18.0.0
> /usr/lib64/libmysqlclient.so.18
> 
> ln -s /myqdata/mysiprdb/data/my.cnf /etc/my.cnf
> 
> This was good for kamailio to open the local MySQL server, but it failed to
> reload a Hash table; the kamcmd htable.reload propertiesHash returns a
> problem :
> 
> kamcmd htable.reload propertiesHash
> 
> error: 500 - Failed to open htable db connection
> 
> The kamailio.log reported that it can't connect the db :
> 
> 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")
> 
> ð  Now with my Kamailio upgraded with 5.0.7-7, it fails immediately at the
> startup to connect the local MySQL server.

Interesting behavior, but as you said - good that its fails now immediately.  
 
> DEBUG: <core> [core/sr_module.c:698]: 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 0x7f65e4974868 not found
> in pool
> 
> DEBUG: db_mysql [km_my_con.c:98]: db_mysql_new_connection(): opening
> connection: mysql://xxxx:xxxx@localhost/siprouter
> 
> ERROR: db_mysql [km_my_con.c:129]: 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")
> 
> That is a strange behavior versus the one with kamailio 5.0.1, but it is
> maybe better as it immediately fails.
> 
> In all the case, I had have to do the following the fix the issue :
> 
> mkdir /var/lib/mysql
> 
> ln -s /myqdata/mysiprdb/data/mysiprdb.sock /var/lib/mysql/mysql.sock
> 
> This new symbolic link would then replace the first I had created : ln -s
> /myqdata/mysiprdb/data/my.cnf /etc/my.cnf.
> 
> If I can consider these problems as fixed, it lets me confused on the manner
> the db_mysql module works.
> 
> I would expect that it would find by configuration the location on the local
> MySQL server. But is seems not.
> [..]

Do you have a [client] section in your my.cnf? It should indeed pick this up 
then. (Have a look to the db_mysql README for an example). If you don't have 
this, I think the mysql libraries then just look for the compiled default. 

There are no module settings in db_mysql module to configure the socket 
setting. It just call the mysql client library. 

If your server runs now and the reload cmd also works fine, I think you should 
be ready to go, the problem is fixed.

Best regards,

Henning

-- 
Henning Westerholt
https://skalatan.de/blog/



More information about the sr-users mailing list