MySQL Storage Engine

This patch adds an alternative storage engine that uses mysql as backend, instead of a big file or a spool directory. This makes some interesting setups possible and also allows to ease the disk I/O on the server (by using an external MySQL engine).

To use it, you first need to create a MySQL database, and a table to hold the store messages. We’ll use “kannel” as DB Name and “store” as the table name, but you can choose whatever you want and modify the config file to reflect your setup (more on this later).

To create the “store” table, run the following SQL query:

CREATE TABLE store ( uuid VARCHAR(36) NOT NULL PRIMARY KEY, message TEXT );

Again, you can rename the fields and modify the config to reflect your environment.

Then, on kannel.conf, you need to add a store-db group, and a mysql-connection pool:

group = mysql-connection
id = mypool
host = localhost
username = <user>
password = <password>
database = kannel
max-connections = 1

group = store-db
id = mypool
table = store
field-uuid = uuid
field-message = message

Last but not least, set the store-type to use the mysql storage engine on the core group:

store-type = mysql

As you may have noticed, you can modify the fields table, field-uuid and field-message to suit your particular database schema.

Here’s the patch against latest CVS:

kannel-mysql-storage-engine

This needs further testing (do not use it for production -yet-), please try it and let me know if you find any problems.

Comments (7)

KatanoOctober 6th, 2008 at 3:05 PM

what store this patch ? dlr or sented sms ?

alexOctober 6th, 2008 at 3:55 PM

None. It replaces the file-based “store” where kannel temporary places messages while processing, so it wont lose them if a crash occurs.

MySQL storage of DLR’s are already a functional part of Kannel (see the userguide for the “dlr-storage” directive).

If you need to archive sent SMS into a MySQL database you should look into SQLBox instead.

EhiOctober 15th, 2008 at 2:02 PM

looks pretty good. will try it out.

RedaniumNovember 28th, 2008 at 5:42 PM

Hi ….thanks for the useful infos …by the way how do we apply this patch ??? thanks again
Redanium

alexNovember 28th, 2008 at 10:37 PM

Supposing that your kannel’s source code is at /usr/local/src/kannel:

1. Download the patch into that folder.
2. Chdir to that folder (cd /usr/local/src/kannel)
3. First try without really patching:

patch -p0 –dry-run < kannel-mysql-storage-engine.patch 4. If all goes well (no FAILED messages) run again, without the --dry-run: patch -p0 < kannel-mysql-storage-engine.patch That's it! If in doubt, try patch --help or man patch. Regards, Alex

RedaniumDecember 1st, 2008 at 7:45 AM

Thanks Alex ,
I got some errors and perhaps it’s due to source code version ,I’m using kannel 1.4 …I’ll try to fix the problem in the same time ….thanks again for the reply

Best regards,
Redanium

alexDecember 1st, 2008 at 9:13 AM

Yes, the patch is against CVS head. It’ll probably need some manual tweaking to apply against 1.4.

Regards,
Alex