sqlbox looking for mysql instead of mssql

偶尔善良 提交于 2019-12-21 20:24:11

问题


I tried to start the sqlbox but it panicked, I ran:

sqlbox -v 0 /etc/kannel/sqlbox.conf

Below is the log:

2017-08-31 13:27:56 [18635] [0] INFO: Debug_lvl = 0, log_file = <none>, log_lvl = 0
2017-08-31 13:27:56 [18635] [0] DEBUG: Kannel sqlbox version `1.4.4'.
Build `Apr  5 2016 13:32:05', compiler `5.3.1 20160330'.
System Linux, release 4.4.0-93-generic, version #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017, machine x86_64.
Hostname smpp.bothsmsw.com, IP 127.0.0.1.
Libxml version 2.9.3.
Using OpenSSL 1.0.2g  1 Mar 2016.
Compiled with MySQL 5.7.11, using MySQL 5.7.19.
Compiled with PostgreSQL 9.5.2.
Using SQLite 3.11.0.
Using hiredis API 0.13.3
Using native malloc.

2017-08-31 13:27:56 [18635] [0] INFO: Starting to log to file /var/log/kannel/sqlbox.log level 0
2017-08-31 13:27:56 [18635] [0] INFO: Added logfile `/var/log/kannel/sqlbox.log' with level `0'.
2017-08-31 13:27:56 [18635] [0] PANIC: SQLBOX: MSSql: connection settings for id 'sqlbox-db' are not specified!
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(gw_backtrace+0xce) [0x42d07e]
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(gw_panic+0x16f) [0x42d1ff]
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(sqlbox_init_mssql+0x11e) [0x40dffe]
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(sqlbox_init_sql+0x9) [0x413239]
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(main+0x31d) [0x40c24d]
2017-08-31 13:27:56 [18635] [0] PANIC: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f3146101830]
2017-08-31 13:27:56 [18635] [0] PANIC: sqlbox(_start+0x29) [0x40c4d9]

I don't why appearing as Compiled with PostgreSQL 9.5.2., I don't use it before, how I can recompile with mysql only & here is the sqlbox configuration:

#SQLBOX
group = sqlbox
id = sqlbox-db
smsbox-id = sqlbox
bearerbox-host = localhost
bearerbox-port = 18001
smsbox-port = 18005
smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-level = 0
log-file = /var/log/kannel/sqlbox.log

# SQLBOX SETUP
group = mysql-connection
id = sqlbox-db
host = localhost
port = 3306
username = root
password = pass
database = kannel_db
max-connections = 25

any idea please?


回答1:


As replied in this topic Kannel Sqlbox not working (trying to connect to SQL Server instead of MySQL)? you can't use the apt-get packages as they are not built with the right parameters.

Problem

The main problem as depicted in the log is there:

2017-08-31 13:27:56 [18635] [0] PANIC: SQLBOX: MSSql: connection settings for id 'sqlbox-db' are not specified!

In fact, there is a problem in the version that you are using (apt-get packages are old versions that you can't use there), I got the same problem at the beginning of the year.

Here is how I made it work.


Solution

Step 1 - Uninstall all your previous Kannel packages, clean everything

If you already installed Kannel with apt-get packages, you have to clean your machine first.

Here are some clues to find the items that you have to remove. I first checked every place where "kannel" was found:

sudo find / -name "*kannel*"
sudo find / -name "*Kannel*"

Then I ran the following commands (some of them may not be useful for you, depending on your settings, etc):

sudo apt-get autoremove --purge kannel
sudo rm -rf /etc/kannel/
sudo apt-get autoremove --purge kannel-sqlbox
sudo rm /var/cache/apt/archives/kannel-sqlbox_0.7.2-4build1_amd64.deb
sudo rm /var/cache/apt/archives/kannel-extras_1.4.4-2build1_amd64.deb
rm /home/nico/www-dev/kannelStore/kannel.store*
sudo rm -rf /usr/local/include/kannel
sudo rm -rf /usr/local/kannel
sudo rm -rf /usr/local/lib/kannel
rm /var/tmp/kannel.swp
sudo rm /usr/local/share/man/man8/kannel.8
sudo rm /usr/local/share/man/man8/run_kannel_box.8

And also sudo rm -rf /usr/local/sbin/ (but be careful here, depending on what you already have in the folder!)


Step 2 - Install latest Kannel version from the source

Note: you will have to use version 1.5.0

Get dependencies

First add all the packages that you need for the future commands:

  • sudo apt-get install libxml2-dev (needed for step ./configure, or you will get "configure: error: You MUST have the libxml2 (aka gnome-xml) library installed")

  • sudo apt-get install libmysqlclient-dev (needed for ./configure --with-mysql)

  • sudo apt-get install bison (needed for make)

  • sudo apt-get install libssh-dev libssl-dev (needed for make to avoid getting this error: "collect2: error: ld returned 1 exit status make: *** [test/test_http] Error 1 ")

Get Kannel sources

You will have to get the sources from a svn repository. So:

  • sudo apt install subversion if you don't have subversion yet (you can check by running svn --version: if no reply, use the command)

Then:

  • Go to the folder that will host the sources locally. For example on m side: cd ~/www-dev/nicopushkannel/Kannel/Kannel-Source

  • Get Kannel sources from the repository: svn co https://svn.kannel.org/gateway/trunk

Build and install Kannel

From the previous step you should be on Kannel sources root foolder. As described in Kannel documentation, run:

cd trunk
./bootstrap
./configure --with-mysql --with-mysql-dir=/var/lib/mysql
make

Here the important things are the parameters added to ./configure: --with-mysql --with-mysql-dir=/var/lib/mysql

Then install:

sudo make bindir=/usr/local/kannel install

Run Kannel

Once this has been done, you can try to run Kannel from command line:

cd /usr/local/sbin
./bearerbox -v 0 /etc/kannel/kannel.conf

Step 3 - Install latest Kannel-sqlbox version from the source

Note: You need to have Kannel installed (step 2) to compile sqlbox.

sqlbox is included in Kannel trunk: navigate to the folder:

cd addons/sqlbox

Patch bootstrap file

You may have to patch the bootstrap file to match your autoconf version (was 1.15 for me), as the code don't understand that 1.15 is > than 1.11...

Change the following value to match your machine version of autoconf: if automake-1.11 --version >/dev/null 2>&1; then amvers="-1.11"

So for me it became: if automake-1.15 --version >/dev/null 2>&1; then amvers="-1.15"

Build and install sqlbox

./bootstrap
./configure
make
sudo make install

We are done!

One more thing: if you want to add Sqlbox startup at Kannel startup:

sudo gedit /etc/default/kannel
Add "START_SQLBOX=1" line at the end


来源:https://stackoverflow.com/questions/45980691/sqlbox-looking-for-mysql-instead-of-mssql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!