RSS
 

Archive for June, 2010

Bacula Update Database Woes

27 Jun

Introduction

Backups, a subject always talked about but rarely put into practice. If you do happen to have a backup solution, excellent, you probably sleep better than our comrades without a recovery plan. I’ve been using bacula for my backup solution for over a year now and one thing I’ve never had enough experience with has been upgrading bacula. The upgrade process can be pretty hairy depending your distribution, level of investment, etc.

Bacula Updates

Recently bacula-5.0.2-r1 was marked as stable for the Gentoo distribution. Upon finishing the emerge (laugh if you like at my compilation of all packages), I attempted the restart of all bacula services to bring the new version live:

/etc/init.d/bacula-sd restart
/etc/init.d/bacula-fd restart
/etc/init.d/bacula-dir restart

All went well until I did the restart on the director (bacula-dir). At that point things took a nasty turn for the worse. The director didn’t want to start and there were no messages on the screen indicating why this might be the case.

Long story short: the database needed some schema changes to be applied before the director could start up and get running again. In order to determine this I needed to run: bacula -u root -g bacula -c /etc/bacula/bacula-dir.conf -fvm. Once I ran this I got some meaningful output that told me I needed to update the database a couple of versions. It’s important to know which versions you are dealing with as you have to run each update to the database individually.

First, a dump of all databases that are relevant is a good idea: mysqldump -A -p > backup.sql. Then, we can move onto updating the databases knowing full well that if something goes awry we simply import our backup and revert bacula to the old version.

The database update scripts were located in /usr/libexec/bacula/updatedb/ and when run in the correct order will get you back up and running in short order. When all is said and done utter the /etc/init.d/bacula-dir and your installation should whir to life once again.

Conclusion

When updating bacula don’t forget the catalog database may have changes that require it to be updated using the various bacula updatedb scripts. Backups should commence at their regularly scheduled time.

 
Comments Off

Posted in Linux Guides

 

Blueman with Dolphin: Bluetooth File Browsing

27 Jun

Introduction

Bluetooth is a convenience that shouldn’t be underestimated. Bluetooth has invaded pretty much every peripheral device we’ve come to know and love: mice, keyboards, ad-hoc networks, etc. One of the most convenient aspects of bluetooth is the ability to browse filesystems through a simple ad-hoc network connection from a phone or other peripheral device.

Enter Blueman

Blueman is my current preferred bluetooth management utility but others do exist including (gnome-bluetooth and kbluetooth). I have found the configurability and freedom of blueman to give me a bit more flexibility than the other solutions.

The problem with blueman under KDE is that first and foremost blueman is a gnome application. Now this isn’t inherently bad but it makes interoperability a little trickier than if I used kbluetooth (which of course hooks directly into KDE). The first issue (and pretty much only issue so far) is that blueman expects you to use nautilus to browse files on a remote device. Again, not bad but I don’t have nautilus so it’s a little tricky to see those files.

Blueman Transfer Settings

Blueman Transfer Settings

What we see in the image above is that we can modify the obex ftp browser that is used by blueman. We’re going to change this to a custom script (shown below) that uses a FUSE obexfs and dolphin to achieve our desired behavior, browsing our bluetooth file with dolphin.

#!/bin/bash
# bluemount.sh

obexfs -b $1  ~/.bluemnt 
dolphin ~/.bluemnt --nofork
fusermount -u ~/.bluemnt

This script requires obexfs, fuse and of course dolphin to work properly. What the script does is mounts the bluetooth file system to a location that we can actually browse (I arbitrarily chose ~/.bluemnt and you can choose another directory if you like). The argument we get from blueman, $1, is the device id that obexfs expects in order to mount our filesystem (very convenient). Once the filesystem is mounted we simply tell dolphin to open that directory but stay in the foreground so we can properly unmount the device when we finish.

Conclusion

Integrating blueman with KDE can seem daunting but a few hooks and scripts allows the two to inter-operate with ease. Now we can simply open our device list and click the browse button to get dolphin to show our files on the bluetooth device in question.

 
Comments Off

Posted in Linux Guides

 

Memcached Remote Memory Sharing

24 Jun

Introduction

Memcached is a simple key/value memory store that allows values from pretty much any application to be stored in memory for quick retrieval. Most languages have simple APIs that make this very easy from a programming standpoint. This also means that it’s not quite as simple to configure as APC (but nearly for modern applications).

Installation and Configuration

To install memcached I recommend using your choice of installation (mine being emerge) and then checking the configuration (again in the case of Gentoo) located at /etc/conf.d/memcached.

Update the file to listen on the interface you want, use the memory you want, etc and then start the daemon up. Now if you’re using memcached on the same server as your apache server most webapps will be able to just turn on memcached and connect and work but if you’re using memcached and apache on separate servers it’s a little more work.

WordPress and memcached

I’ve already touted the wordpress plugin: W3 Total Cache but unfortunately this plugin doesn’t allow you to easily configure memcached usage through the web interface. It defaults to using the memcached server located at 127.0.0.1:11211 which if we’re using separate servers is less than ideal. The file we need to modify with a simply sed (or by hand if you prefer knowing what’s going on) is %{DOCROOT}/wp-content/w3-total-cache-config.php.

We just need to change the memcached servers to point at our server’s location before enabling it in the interface. To easily accomplish this we can use sed:

sed -i -e 's/127.0.0.1:11211/<host>:<port>/g' %{DOCROOT}/wp-content/w3-total-cache-config.php

Mediawiki and memcached

The other application we can easily setup for memcached is mediawiki. Mediawiki wants us to modify its LocalSettings.php with the following additions:

## Shared memory settings 
$wgMainCacheType = CACHE_MEMCACHED; 
$wgParserCacheType = CACHE_MEMCACHED; 
$wgMessageCacheType = CACHE_MEMCACHED; 
$wgMemCachedServers = array("giskard.alunduil.com:11211"); 

$wgSessionsInMemcached = true; 

These settings simply turn on memcached (CACHE_MEMCACHED) for the various caching areas that mediawiki uses and specifies an array of memcached servers to store that caching information in.

If you do have more than one memcached server configured and available you can use the following syntax to include all of them with various weights:

$wgMemCachedServers = array(array("host:port", weight), array("host2:port2", weight));

Conclusion

Using memcached can greatly improve the performance of webapps or other applications that don’t need to present the most up to date information. This can reduce traffic to an overloaded database or configuration file or whatever other store you want to place a cache in front of.