Skip to content

Backing up MySQL using ZFS Snapshots: SnapBack

While browsing the many blog entries on blogs.sun.com about the MySQL Acquisition (thanks a lot for the very warm welcome!), I stumbled over this (Python-based) utility: SnapBack, a tool that uses ZFS snapshots to perform physical backups of MySQL databases on Solaris. Very cool! This is actually something I was wanting to add to the mylvmbackup script, too - I have to take a closer look at how this is done (I tried to install OpenSolaris on a VirtualBox instance, but it caused it to crash the emulator).
 

 

A hidden gem in the MySQL distribution: replace

Since the very early days, the MySQL distribution packages contain a very useful commandline-tool named replace. As the name implies, it can be used to replace strings in text files. From the documentation:

The replace utility program changes strings in place in files or on the standard input. Invoke replace in one of the following ways:
shell> replace from to [from to] ... -- file [file] ...
shell> replace from to [from to] ... < file
from represents a string to look for and to represents its replacement. There can be one or more pairs of strings. Use the -- option to indicate where the string-replacement list ends and the filenames begin. In this case, any file named on the command line is modified in place, so you may want to make a copy of the original before converting it. replace prints a message indicating which of the input files it actually modifies. If the -- option is not given, replace reads the standard input and writes to the standard output. replace uses a finite state machine to match longer strings first. It can be used to swap strings. For example, the following command swaps a and b in the given files, file1 and file2:
shell> replace a b b a -- file1 file2 ...

This comes in very handy, especially if you need to replace a similar text in a large number of files, or if you need to replace multiple different strings in a file at the same time! So next time you need to replace strings in text files, take a look at this hidden gem!

Unfortunately the string matching does not support regular expressions - but the source code actually documents some additional options:

Special characters in from string:
^ Match start of line.
\$  Match end of line.
\b  Match space-character, start of line or end of line.
        For end \b the next replace starts locking at the end space-character.
        An \b alone or in a string matches only a space-character.
\r, \t, \v as in C.

The programs make a DFA-state-machine of the strings and the speed isn't
dependent on the count of replace-strings (only of the number of replaces).
A line is assumed ending with \n or \0.
There are no limit exept memory on length of strings.

 

 

 

 

Presenting the MySQL Conference & Expo 2008 DotOrg Pavilion attendees

Like in the past two years, there will be a DotOrg-Pavilion as part of the MySQL Conference & Expo 2008 exhibition floor. We've now concluded the invitation process - the following 15 Open Source projects that support MySQL will be present to showcase their work:

  • CMS made simple - a fast and easy way to create a web site and manage its contents.
  • DbBlender - a project that implements SQL support in Blender to enable remote repository capabilities.
  • Entrance - an easy-to use browser for MySQL databases.
  • Deki Wiki - a free open source wiki and application platform for communities and enterprises.
  • lbpool - a load balancing JDBC driver for use with DB connection pools.
  • memcached - a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
  • Mojo Portal - an open source web site framework and content management system written in C# that runs under ASP.NET on Windows or under Mono on Linux or Mac OS X.
  • Open Medical Record System - a community-developed, open-source, enterprise electronic medical record system framework intended to aid resource-constrained healthcare environments.
  • phpMyAdmin - a tool written in PHP intended to handle the administration of MySQL over the Web.
  • PHP Women - a user group specifically targeted toward the women in the PHP world.
  • Phorum - a modular and powerful Forum siste, written in PHP.
  • SilverStripe CMS - an intuitive content management system atop a powerful programming framework.
  • Sphinx FULLTEXT Search Engine - a standalone full-text search engine, meant to provide fast, size-efficient and relevant fulltext search functions to other applications
  • Symfony - a web application framework for PHP5 projects.
  • XAMPP - an easy to install Apache distribution containing MySQL, PHP and Perl.

I hope that the list above encourages you to strongly consider visiting the MySQL Conference! If not the list of projects above, I am sure that the session schedule will provide enough incentive for you to register now! See you there!

Speaking at the MySQL Conference & Expo 2008

MySQL Conference & Expo - April 14-17, 2008, Santa Clara, CA - SpeakerI am happy to announce that I have been selected to speak at the MySQL Conference & Expo 2008 on April 14-17, 2008 in Santa Clara, CA. The topic of my talk will be "Performing MySQL Backups using LVM Snapshots" - and I will of course include a plug for the mylvmbackup tool :-)

From the abstract:

Modern Linux distributions provide a very advanced technology to maintain and administer storage devices, called “Logical Volume Manager” (LVM). Among providing several benefits over using plain hard disk partitions, one of the unique features of LVM is the capability to create snapshots of file systems on the fly. This functionality comes in handy for performing consistent physical backups of MySQL tables without having to take down the MySQL server for the entire backup operation.

In this session, Lenz will give an introduction to the underlying technology, the actual steps that have to be performed and which caveats there may be. Additionally, he will introduce “mylvmbackup”, a script created to automate and ease the described procedure.

My talk has been scheduled as part of the "Security and Database Administration" track for 17:15 on Wednesday, April 16th in Ballroom B - the last slot before the infamous Quiz Show!

 

 

tweetbackcheck