[SR-Users] Runnning kamailio (docker) with remote connection with MYSQL (docker) fails on start/restart due to socket or database connection

Nuñez, Mario mario.nunez at atos.net
Tue Feb 16 14:04:51 CET 2021


Hi,
I am running docker with this:
https://hub.docker.com/layers/kamailio/kamailio/5.4.3-trusty/images/sha256-cff154ee955e828dc00021531e0d0a7d1794939c9bdd785aa7ee0f1ce63e3dc2?context=explore
and
https://hub.docker.com/layers/mysql/library/mysql/8.0.23/images/sha256-870892ea5cc8c623b389717c2eedd58248c82a8569d7601ede62a63d527641bd?context=explore

I made some configurations in Kamailio container:
/etc/default/kamailio
RUN_KAMAILIO=yes
USER=kamailio
GROUP=kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DUMP_CORE=yes


/etc/kamailio/kamailio.cfg
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB


/etc/kamailio/kamctlrc
SIP_DOMAIN=kamailio.org
DBENGINE=MYSQL
DBHOST=172.19.0.3
DBPORT=3306
DBNAME=kamailio
DBRWUSER="kamailio"
DBRWPW="kamailiorw"
DBROUSER="kamailioro"
DBROPW="kamailioro"
DBACCESSHOST=172.19.0.5
DBROOTUSER="root"
DBROOTPW="whatever"
CHARSET="latin1"
USERCOL="user"

Then I run creation of database:
/usr/sbin/kamdbctl create
All was ok so I can see in  MYSQL database:
+------------------+------------+-----------------------+
| user             | host       | plugin                |
+------------------+------------+-----------------------+
| root             | %          | mysql_native_password |
| kamailio         | 172.19.0.3 | mysql_native_password |
| kamailioro       | 172.19.0.3 | mysql_native_password |
| kamailio         | 172.19.0.5 | mysql_native_password |
| kamailioro       | 172.19.0.5 | mysql_native_password |
| kamailio         | localhost  | mysql_native_password |
| kamailioro       | localhost  | mysql_native_password |
| mysql.infoschema | localhost  | caching_sha2_password |
| mysql.session    | localhost  | caching_sha2_password |
| mysql.sys        | localhost  | caching_sha2_password |
| root             | localhost  | mysql_native_password |
+------------------+------------+-----------------------+

At this point, if I try to restart kamailio i get an error and container will never go up again, so I had to delete it and restart the whole  installation and configuration process.
Log details are:
==========================================ON RESTART KAMAILIO FROM CONTAINER CONSOLE:

Listening on
udp: 127.0.0.1:5060
udp: 172.17.0.4:5060
tcp: 127.0.0.1:5060
tcp: 172.17.0.4:5060

Aliases:
tcp: mykamailio:5060
tcp: localhost:5060
udp: mykamailio:5060
udp: localhost:5060

0(1) INFO: <core> [core/tcp_main.c:4984]: init_tcp(): using epoll_lt as the io watch method (auto detected)
0(1) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
0(1) INFO: rr [rr_mod.c:185]: mod_init(): outbound module not available
0(1) INFO: <core> [main.c:2834]: main(): processes (at least): 33 - shm size: 67108864 - pkg size: 8388608
0(1) INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
0(1) INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
0(1) INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
0(1) INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
21(28) INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/28
23(30) INFO: ctl [io_listener.c:214]: io_listen_loop(): io_listen_loop: using epoll_lt io watch method (config)
0(1) ALERT: <core> [main.c:774]: handle_sigs(): child process 205 exited normally, status=255
0(1) INFO: <core> [main.c:802]: handle_sigs(): terminating due to SIGCHLD
2(9) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
1(8) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
3(10) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
4(11) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
6(13) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
5(12) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
7(14) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
10(17) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
12(19) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
14(21) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
29(36) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
24(31) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
28(35) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
15(22) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
19(26) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
13(20) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
17(24) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
8(15) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
23(30) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
22(29) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
21(28) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
26(33) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
20(27) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
31(38) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
32(39) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
9(16) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
30(37) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
11(18) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
16(23) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
27(34) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
18(25) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
25(32) INFO: <core> [main.c:857]: sig_usr(): signal 15 received
0(1) ERROR: ctl [ctl.c:390]: mod_destroy(): ERROR: ctl: could not delete unix socket /var/run/kamailio//kamailio_ctl: No such file or directory (2)
0(1) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized



==========================================SO CONTAINER WAS DOWN, AND THEN IF I TRY TO START CONTAINER AGAIN:

Listening on
udp: 127.0.0.1:5060
udp: 172.17.0.4:5060
udp: 172.19.0.5:5060
tcp: 127.0.0.1:5060
tcp: 172.17.0.4:5060
tcp: 172.19.0.5:5060

Aliases:
tcp: mykamailio:5060
tcp: localhost:5060
udp: mykamailio:5060
udp: localhost:5060

0(1) INFO: <core> [core/tcp_main.c:4984]: init_tcp(): using epoll_lt as the io watch method (auto detected)
0(1) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
0(1) INFO: rr [rr_mod.c:185]: mod_init(): outbound module not available
0(1) INFO: auth [auth_mod.c:346]: mod_init(): qop set, but nonce-count (nonce_count) support disabled
0(1) INFO: <core> [main.c:2834]: main(): processes (at least): 41 - shm size: 67108864 - pkg size: 8388608
0(1) ERROR: db_mysql [km_my_con.c:163]: db_mysql_new_connection(): driver error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
0(1) ERROR: <core> [db.c:319]: db_do_init2(): could not add connection to the pool
0(1) ERROR: usrloc [dlist.c:852]: register_udomain(): failed to open database connection
0(1) ERROR: registrar [registrar.c:711]: domain_fixup(): failed to register domain
0(1) ERROR: <core> [core/route.c:1167]: fix_actions(): fixing failed (code=-1) at cfg:/etc/kamailio/kamailio.cfg:698
0(1) ERROR: <core> [core/rvalue.c:3869]: fix_rval_expr(): failure in cfg at line: 698 col: 22
0(1) ERROR: <core> [core/rvalue.c:3869]: fix_rval_expr(): failure in cfg at line: 698 col: 22
0(1) ERROR: <core> [core/route.c:1167]: fix_actions(): fixing failed (code=-1) at cfg:/etc/kamailio/kamailio.cfg:701
error -1 while trying to fix configuration
0(1) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized


======================================================SO NO WAY TO GET IT UP.

Any idea on what could be the problem?
I tried giving permissions to some folders in Kamailio docker container:

chown kamailio:kamailio /usr/sbin/kam*
chmod 755 /usr/sbin/kam*
chown -R kamailio:kamailio /etc/kamailio
chmod -R 755 /etc/kamailio

chown -R root:kamailio /var/run
chmod -R 755 /var/run

chown -R kamailio:kamailio /run/kamailio
chown -R 755 /run/kamailio

But had no effect... and I do not know if there is any misconfiguration out there. Indeed I tried to configure it to use remote Postgresql and failed, so I came back to MYSQL as it looks somekind of default config. To Kamailio.
Thank you in advance.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.

Este mensaje y los ficheros adjuntos pueden contener información confidencial destinada solamente a la(s) persona(s) mencionadas anteriormente y pueden estar protegidos por secreto profesional.
Si usted recibe este correo electrónico por error, gracias por informar inmediatamente al remitente y destruir el mensaje.
Al no estar asegurada la integridad de este mensaje sobre la red, Atos no se hace responsable por su contenido. Su contenido no constituye ningún compromiso para el grupo Atos, salvo ratificación escrita por ambas partes.
Aunque se esfuerza al máximo por mantener su red libre de virus, el emisor no puede garantizar nada al respecto y no será responsable de cualesquiera daños que puedan resultar de una transmisión de virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210216/85d77e88/attachment.htm>


More information about the sr-users mailing list