Am Freitag, 31. August 2018, 09:07:51 CEST schrieb Ginhoux, Patrick:
In a previous post ([SR-Users] Questions about changes between 5.0.1 and 5.0.7 https://lists.kamailio.org/pipermail/sr-users/2018-August/102442.html ), I reported problem to upgrade my kamailio from 5.0.1 to 5.0.7-7 level.
With help from some people, it was finally fixed on my test server in my lab.
Hello Patrick,
the mysql module will usually just give you the error message back from the server/mysql client library.
Can you try to connect with the "mysql" client command on the command line to connect to the local server, with the same username/password as in your Kamailio configuration?
Now I was expecting to do the same upgrade on a real server using these packages:
kamailio-5.0.7-7.el7.x86_64.rpm kamailio-ims-5.0.7-7.el7.x86_64.rpm kamailio-mysql-5.0.7-7.el7.x86_64.rpm kamailio-perl-5.0.7-7.el7.x86_64.rpm kamailio-snmpstats-5.0.7-7.el7.x86_64.rpm
But kamailio failed to connect the local MySQL server :
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: DEBUG: <core> [db.c:209]: db_bind_mod(): using db bind api for db_mysql
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: DEBUG: <core> [db.c:314]: db_do_init2(): connection 0x7fef779958f8 not found in pool
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: DEBUG: db_mysql [km_my_con.c:98]: db_mysql_new_connection(): opening connection: mysql://xxxx:xxxx@localhost/siprouter
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: 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' (13 "Permission denied")
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: ERROR: <core> [db.c:318]: db_do_init2(): could not add connection to the pool
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: ERROR: htable [ht_db.c:92]: ht_db_open_con(): failed to connect to the database
Aug 31 08:16:20 in52inmvt2router1-mvt-tpm-sipr /usr/sbin/kamailio[6365]: ERROR: <core> [core/sr_module.c:974]: init_mod(): Error while initializing module htable (/usr/lib64/kamailio/modules/htable.so)
My "kamailio.cfg" contains the following command:
modparam("htable", "db_url", "mysql://siprouter:password@localhost/siprouter")
The service unit : "/usr/lib/systemd/system/kamailio.service" content is :
[Unit]
Description=Kamailio (OpenSER) - the Open Source SIP Server
After=network.target mysql.service
[Service]
Type=simple
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
Environment='SHM_MEMORY=1024'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/sysconfig/kamailio
ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
[Install]
WantedBy=multi-user.target
The "/etc/sysconfig/kamailio" content is :
#
# Kamailio startup options
#
#
# Kamailio startup options
#
# Set to yes to enable kamailio, once configured properly.
RUN_KAMAILIO=yes
# User to run as
USER=kamailio
# Group to run as
GROUP=kamailio
# Amount of shared memory to allocate for the running Kamailio server (in Mb)
SHM_MEMORY=1024
# Amount of per-process (package) memory to allocate for Kamailio (in Mb)
PKG_MEMORY=8
Below the existing user in mysql :
mysql:root:(none)> use mysql;
Database changed
mysql:root:mysql> select user,host from user;
+-----------+-----------+
| user | host |
+-----------+-----------+
| myadmin | % | | | siprouter | % | | | kamailio | localhost | | | root | localhost |
+-----------+-----------+
I have a symlink to locate the my.cnf : ln -s /myqdata/mysiprdb/data/my.cnf /etc/my.cnf
And also this link to fix a htable reload problem : ln -s /myqdata/mysiprdb/data/mysiprdb.sock /var/lib/mysql/mysql.sock
I don't find what the problem is this time.
So if there is people that could help on the issue, thanks in advance.
Cordialement.
Patrick GINHOUX