Hi,
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.
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
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
Hi Henning,
Usually I connect on a command line like this ;
su- mysql
mysql
use siprouter;
If now I use
mysql -u siprouter -p
Enter password:
mysql:siprouter:(none)> use siprouter;
Database changed
So I can connect the local server.
Cordialement.
Patrick GINHOUX
Unisys | +33 1 46 69 52 12 | +33 6 60 32 24 74 | patrick.ginhoux@unisys.com
-----Message d'origine----- De : Henning Westerholt hw@kamailio.org Envoyé : vendredi 31 août 2018 19:07 À : sr-users@lists.kamailio.org Cc : Ginhoux, Patrick patrick.ginhoux@fr.unisys.com Objet : Re: [SR-Users] Can't connect to local MySQL server (13 "Permission denied")
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
https://lists.kamailio.org/pipermail/sr-users/2018-August/102442.html%3E ), 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
Am Freitag, 31. August 2018, 21:01:13 CEST schrieb Ginhoux, Patrick:
Usually I connect on a command line like this ;
su- mysql
mysql
use siprouter;
If now I use
mysql -u siprouter -p
Enter password:
mysql:siprouter:(none)> use siprouter;
Database changed
So I can connect the local server.
Hello Patrick,
just some ideas to help you troubleshoot the problem:
- maybe there is an issue with the socket file, that kamailio uses the wrong socket file? - maybe kamailio don't have file system access rights to the socket file? - maybe there is a mistake in the kamailio cfg or an old cfg file is used? - enable mysql server logging and try to spot something in the log during the kamailio start
Best regards,
Henning
Make sure the password is correct and try with "localhost" and if that doesn't work, try with 127.0.0.1
On Tue, Sep 4, 2018, 07:35 Henning Westerholt hw@kamailio.org wrote:
Am Freitag, 31. August 2018, 21:01:13 CEST schrieb Ginhoux, Patrick:
Usually I connect on a command line like this ;
su- mysql
mysql
use siprouter;
If now I use
mysql -u siprouter -p
Enter password:
mysql:siprouter:(none)> use siprouter;
Database changed
So I can connect the local server.
Hello Patrick,
just some ideas to help you troubleshoot the problem:
- maybe there is an issue with the socket file, that kamailio uses the
wrong socket file?
- maybe kamailio don't have file system access rights to the socket file?
- maybe there is a mistake in the kamailio cfg or an old cfg file is used?
- enable mysql server logging and try to spot something in the log during
the kamailio start
Best regards,
Henning
-- Henning Westerholt https://skalatan.de/blog/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
You should paste your failing cfg line.
On Tue, Sep 4, 2018, 08:39 David Villasmil david.villasmil.work@gmail.com wrote:
Make sure the password is correct and try with "localhost" and if that doesn't work, try with 127.0.0.1
On Tue, Sep 4, 2018, 07:35 Henning Westerholt hw@kamailio.org wrote:
Am Freitag, 31. August 2018, 21:01:13 CEST schrieb Ginhoux, Patrick:
Usually I connect on a command line like this ;
su- mysql
mysql
use siprouter;
If now I use
mysql -u siprouter -p
Enter password:
mysql:siprouter:(none)> use siprouter;
Database changed
So I can connect the local server.
Hello Patrick,
just some ideas to help you troubleshoot the problem:
- maybe there is an issue with the socket file, that kamailio uses the
wrong socket file?
- maybe kamailio don't have file system access rights to the socket file?
- maybe there is a mistake in the kamailio cfg or an old cfg file is used?
- enable mysql server logging and try to spot something in the log during
the kamailio start
Best regards,
Henning
-- Henning Westerholt https://skalatan.de/blog/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi,
Looking at your message, I checked again the installation and mainly the symlink I had created for Kamailio to get the socket file.
For some reason, this link were corrupted. Hereafter what was the issue:
The initial symlink for the socket file was : ln -s /myqdata/mysiprdb/data/mysiprdb.sock /var/lib/mysql/mysql.sock
But actually a locate command : returns strange
locate *.sock
/myqdata/mysiprdb/data/mysiprdb.sock
/var/lib/gssproxy/default.sock
/var/lib/mysql/mysql.sock
/var/lib/mysql/mysql.sock/mysiprdb.sock
The “/var/lib/mysql/mysql.sock/mysiprdb.sock” doesn’t make sense here.
And the “/var/lib/mysql/mysql.sock” was actually a directoty
[root@in52inmvt2router1 ~]# ll /var/lib/mysql/
total 4
drwx------ 2 root root 4096 Sep 4 10:21 mysql.sock
Removing all of these files/directories, then recreate the symlink have fixed the issue.
Thanks everybody for your ideas of things to check..
Cordialement.
Patrick GINHOUX
Unisys | +33 1 46 69 52 12 | +33 6 60 32 24 74 | patrick.ginhoux@unisys.com
De : David Villasmil david.villasmil.work@gmail.com Envoyé : mardi 4 septembre 2018 09:41 À : Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc : Ginhoux, Patrick patrick.ginhoux@fr.unisys.com Objet : Re: [SR-Users] Can't connect to local MySQL server (13 "Permission denied")
You should paste your failing cfg line.
On Tue, Sep 4, 2018, 08:39 David Villasmil <david.villasmil.work@gmail.com mailto:david.villasmil.work@gmail.com > wrote:
Make sure the password is correct and try with "localhost" and if that doesn't work, try with 127.0.0.1
On Tue, Sep 4, 2018, 07:35 Henning Westerholt <hw@kamailio.org mailto:hw@kamailio.org > wrote:
Am Freitag, 31. August 2018, 21:01:13 CEST schrieb Ginhoux, Patrick:
Usually I connect on a command line like this ;
su- mysql
mysql
use siprouter;
If now I use
mysql -u siprouter -p
Enter password:
mysql:siprouter:(none)> use siprouter;
Database changed
So I can connect the local server.
Hello Patrick,
just some ideas to help you troubleshoot the problem:
- maybe there is an issue with the socket file, that kamailio uses the wrong socket file? - maybe kamailio don't have file system access rights to the socket file? - maybe there is a mistake in the kamailio cfg or an old cfg file is used? - enable mysql server logging and try to spot something in the log during the kamailio start
Best regards,
Henning