Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Code and Hacks MySQL Master-Master Replication over a Secure Stunnel Connection (SSL)

Posted by Admin • Saturday, February 7. 2009 • Category: Code and Hacks
I threw this together because I had to figure it out myself. I found info on how to setup master-master, and I found info on how to set up MySQL replication over stunnel. But master-master over stunnel turned out to be a little different. Not much, but here it is.

First of all - I won't go into the steps for setting up Master-Master itself - that's very well documented. Let's assume that you can convince one of your mysql's to slave off the other, and vice versa. (I used this page as a guide).

With that accomplished, let's assume that the boxes are not sitting next to each other but are in separate colo's or offices, and have some insecure internet to go between them (or maybe you don't even trust the local LAN). Yes, MySQL does have built-in SSL stuff, but so far the consensus is that it's rather difficult to work with. Moreover, I am more willing to trust stunnel (just my feeling on it).

Why not use ssh? Using something like ssh -n with a for loop that restarts it just doesn't sound enterprise-grade. I want something that actively reconnects when needed, based on active usage, and is actually intended for this. I still use SSH for port tunnelling all the time, but those are short-lived tunnels for my own personal use or debugging.

So our goals are: Secure transport and identity validation. Here we go.

Continue reading "MySQL Master-Master Replication over a Secure Stunnel Connection (SSL)"

Asterisk Data Warehousing and Metrics with Asterisk PBX

Posted by Admin • Sunday, February 1. 2009 • Category: Asterisk
An Asterisk installation I am doing for a client has the promise of two interesting developments in the near future:

  1. Writing a CDR/Voicemail status-tracking application that makes sure that all client voicemails are handled within one hour and keeps track of what was done
  2. A future custom metrics/data warehouse implementation that will use both the CDR and VoiceMail data

With that in mind (and the fact that I'm using Mysql master-master replication across offices) I looked into storing the voicemails in the database as well. This is fairly well-documented. I had this up and running in no time, and now for each voicemail I have a neat row in my MySQL table.

The problem is - how do I connect the row in CDR table to the matching voicemail row? There are no columns that have data to allow you to do match one to the other. Even timestamps, if you were so desperate, are not exactly the same! So this is how I did it.

Continue reading "Data Warehousing and Metrics with Asterisk PBX"