Beware of using Pylibmc 1.1+ and mod_wsgi

Recently, we attempted to bring up a new web server but to our dismay after it was all said and done, the Django application wouldn’t load. Eventually a “gateway timeout” was thrown with no errors in the wsgi or Apache error log. These types of errors are a pain to debug. What made the mystery even better, was the application ran just fine under the Django dev server!
Continue reading

Enable logging in HAProxy on FreeBSD

This may apply to more than just FreeBSD, but it’s been tested and working on FreeBSD. I wanted to keep the syslogd locked down while letting HAProxy still log. All the example configurations I could find use a network interface to syslogd, which I have completely disabled. So this details using a local socket (which isn’t all that much different).
Continue reading

How to keep a passive-master MySQL database warm

When you have a passive master (in a master-master setup), there is usually no queries going to it. If there are no queries it will not have its buffers/caches at least semi-ready for a production workload. Maatkit (love this toolkit) has a nice little tool to help do this, mk-query-digest. Now this is only 1 of many uses for this tool. So visit the mk-query-digest doc to find out the rest of its many uses.
Continue reading

Taking a hot backup of a MySQL database with XtraBackup

A hot backup means you don’t have to take the database offline or stop sending traffic to it. This is especially useful for creating new replication slaves. A hot backup takes minutes vs the hours a dump/import would take. Ideally, all the tables in the database need to be InnoDB; however, Percona has adapted a script (innobackupex) to also backup MyISAM tables (if there are MyISAM tables then you probably should stop sending traffic to it as those require table locks). What makes XtraBackup so nice (besides being free) is that it logs C_UD statements to applied during restoration and it can do incremental backups as well.
Continue reading