Playing with MySQL’s Online Backup

May 3rd, 2008

Something that has excited me for a long time with upcoming features in the MySQL Server, is online backup. Since seeing it first being demonstrated by Chuck Bell at the Heidelberg Developers Conference in 2007, I’ve been enthralled. Now you too, can try online backup.

If you’ve not read the Forge Wiki page about it yet, please head over to Online Backup on the Wiki. You can grab the latest source from mysql-6.0-backup from mysql.bkbits.net. If you’ve never built MySQL from source before, go ahead and read Building MySQL from source. And you naturally need to test it once built, so I suggest making use of MySQL Sandbox.

NOTE: mysql-6.0-backup is the MySQL Backup Team Tree, and frequently changes and can break sometimes. This is not for production use. It can eat babies.

So, you’ve got BitKeeper (bkf) built, you’ve checked out the code, you’ve built it, and you have a binary distribution.

Place the built version in a location that sanbox likes (/opt/mysql in my case). Now, run ./express-install.pl /opt/mysql/mysql-6.0.6-alpha-darwin9.2.1-i386.tar.gz. Once the install is completed, head over to ~/msb_6_0_6 and run ./use.

Backing up…

I now loaded the sakila sample database. Then, I proceeded to backup the database.

BACKUP DATABASE sakila TO 'sakila-backup.sql';
+-----------+
| backup_id |
+-----------+
| 1         |
+-----------+
1 row in set (0.37 sec)

sakila-backup.sql is saved in your MySQL “data” directory, and in the case of the sandbox, its kept in your home directory.

du -sh ~/msb_6_0_6/data/sakila-backup.sql
1.9M	/Users/ccharles/msb_6_0_6/data/sakila-backup.sql

Out of curiosity, I ran file on the backup, and it was reported to be data (not ASCII English text, with very long lines):

file ~/msb_6_0_6/data/sakila-backup.sql
/Users/ccharles/msb_6_0_6/data/sakila-backup.sql: data

Once you’ve done the backup, you might want to check the state:

SELECT * FROM mysql.online_backup WHERE backup_id = 1 \G
*************************** 1. row ***************************
          backup_id: 1
         process_id: 0
         binlog_pos: 0
        binlog_file: NULL
       backup_state: complete
          operation: backup
          error_num: 0
        num_objects: 16
        total_bytes: 1654492
validity_point_time: 2008-05-03 18:55:19
         start_time: 2008-05-03 18:55:18
          stop_time: 2008-05-03 18:55:19
host_or_server_name: localhost
           username: msandbox
        backup_file: sakila-backup.sql
       user_comment:
            command: BACKUP DATABASE sakila TO 'sakila-backup.sql'
            engines: Default
1 row in set (0.00 sec)

online_backup provides statistics and metadata about a backup or restore. There is another table in the mysql database, that allows you to find progress information, and its called online_backup_progress.

If you run SELECT * FROM mysql.online_backup_progress WHERE backup_id = 1 \G, you’ll see notes changing from starting, running, validity point, running to complete.

Restoring…

Now, its time to restore. Note that the restore is what is known as a destructive restore (i.e. it will replace the current version of the database).

RESTORE FROM 'sakila-backup.sql';
+-----------+
| backup_id |
+-----------+
| 2         |
+-----------+
1 row in set (3.04 sec)

That’s it! You’ve restored your database. For posterity, here’s some statistics on the restore:

SELECT * FROM mysql.online_backup WHERE backup_id = 2 \G
*************************** 1. row ***************************
          backup_id: 2
         process_id: 0
         binlog_pos: 0
        binlog_file: NULL
       backup_state: complete
          operation: restore
          error_num: 0
        num_objects: 16
        total_bytes: 1654492
validity_point_time: NULL
         start_time: 2008-05-03 19:01:25
          stop_time: 2008-05-03 19:01:28
host_or_server_name: localhost
           username: msandbox
        backup_file: sakila-backup.sql
       user_comment:
            command: RESTORE FROM 'sakila-backup.sql'
            engines: Default
1 row in set (0.00 sec)

There you have it, MySQL 6.0’s Backup and Restore functionality. Still in its early stages of development, but very, very cool! All these features will also be available in MySQL 6.0.5, when this gets released…

Stewart and I on LugRadio

May 3rd, 2008

Stewart (Melbourne, Australia) and I (Kuala Lumpur, Malaysia) are featured in LugRadio Live! USA 2008. Why? We were one of the few people that travelled far enough to get to LugRadio Live.

27:30-27:40 in case you want to fast forward. “I don’t even know where Malaysia is!” exclaims someone on LugRadio. Definitely, grab the show, Season 5, Episode 16.

In the end we all get gifts… an Ubuntu book which I will eventually read.

For me, its an interesting change, writing “Kuala Lumpur, Malaysia” on things.

google visitor

NetBeans 6.1 with GlassFish, MySQL bundle

May 2nd, 2008

I couldn’t resist downloading NetBeans 6.1, with GlassFish and the MySQL bundle, the moment I found out it was released. Pulling it down while at the Star Alliance Gold lounge in Singapore was easy enough, and it only took me an hour (its a pretty big bundle - 164MB, as opposed to 6.0.1 where it only weighed in at 143MB for the OS X bundle).

Instead of the 4 packages in 6.0.1, I now only see 2 files - MySQL.prefPane (because we only fixed this in 5.0.51b, which probably didn’t make the release cut-off - the included version is 5.0.51a-community), and NetBeans IDE with MySQL.mpkg. The install is slated to take 526MB and takes a good two minutes.

I noticed that it doesn’t uninstall NetBeans 6.0.1, so my Applications folder now has two versions, including two versions of Glassfish (UR1 from 6.0.1 versus UR2 in 6.1). Upon starting 6.1, it does ask if I’d like to import settings from a previous version of NetBeans; of course I would.

You are then asked to register. I never looked at registering software as important, but I’m starting to think a lot more about it. One has to provide value, for a user to register - and we’ll explore this in another blog post. I’m writing this while on a plane, so it doesn’t make sense to register, anyway.

The first thing I do? Jump to the Services tab, make a connection to MySQL (look under Drivers -> MySQL (Connector/J driver)), and play with the sakila sample database.

NetBeans IDE 6.1 does queries in a GUI!
Design a query, using a GUI

Drill down into tables, find a table name (say, store if using the sakila sample database), drill down into a row, like store_id, right-click, and select Design Query. Now, feel free to drag tables and drop them, only to find that it now helps you create an ER diagram of your tables, while helping you design an appropriate query!

NetBeans IDE 6.1 does ER diagrams too!
ER diagrams for free

Play with the database tool a lot more. It looks like its got plenty of potential. It also looks like NetBeans is a great IDE for all your web development needs (PHP included). I’m certainly going to use it a lot more, even though I’m notably a vim guy.

OpenSolaris Summit, CommunityOne, JavaOne - big week ahead

May 2nd, 2008

I’m headed to the OpenSolaris Developers Summit right now.

After that, I’ll be at CommunityOne, with the rest of the MySQL team. Just check out the schedule (its in PDF format though). Its truly packed, so if you’ve not signed up to come, do so, immediately. I’m also particularly interested in participating in the RedMonk Unconference. All in all, I think CommunityOne looks like it would be well suited for a week-long event, rather than a day-long event - so many places to be, so little time!

And after that, JavaOne! Its going to be packed all week long, but the good news is that I’ll be in downtown San Francisco for most of it.

Expect plenty of notes soon.

Technorati Tags: , , , ,

Appalling journalism that is iTWire

April 30th, 2008

While I am not a Jeff Waugh apologist (disclaimer: he’s a friend of mine, whom I met through the open source community), I find this kind of journalism, simply appalling.

Five whole pages over the running of a Planet? With pulling out details from the archives of lists? It clearly looks like Sam Varghese is a little bored these days. And iTWire, which is on my “daily” to read list, is on the verge of being removed. Its becoming drivel.

If Jeff was really doing a bad job, and this is after all the open source world, where is the fork of Planet GNOME?

P/S: For added value, read the comments.

OpenOffice.org and ODF adoption in Malaysia - thumbs up!

April 27th, 2008

In an interesting twist (interesting for Microsoft and their OOXML apologists), about a month ago, MAMPU, the Malaysian Administrative Modernisation and Management Planning Unit, decided that they were going to go OpenOffice.org and go ODF, and dump Microsoft Office by year-end 2008. This made its round around news sites, and everyone was naturally talking about it.

Now, you can hold them to their word, as they update a Wiki page, informing you about how many agencies are moving to OpenOffice.org. Big wins, once all of the Malaysian government related agencies are on OpenOffice.org (open source software in general). Again, read OpenOffice.org and ODF Adoption!

As a current Malaysian tax payer, I wouldn’t want the government misappropriating money, on proprietary software.

One interesting bit from that? OpenOffice.org being taught in matriculation colleges (11 currently), as lecturers are trained to deliver it to their students. It all starts in schools, though, but this is much better than what was previously around.

Go OpenOffice.org! Go ODF!

Technorati Tags: , , ,

Contributing to the MySQL User Guide

April 24th, 2008

The MySQL User Guide is worth looking at. Its not the reference manual (which is excellent - kudos to our Documentation Team). Its target audience are users that are new to databases or users that are new to MySQL in general.

What’s really interesting about the MySQL User Guide is that you can help shape it. You, the community, can participate in writing it!

I for one, know that this is the easiest way you can start contributing to any open source project. Documenting it. Soon, you will realise that you’ve become an expert (writing documentation, or giving training, will always keep you sharp). Some move on to then delving in coding, some go on being consultants, and some end up being hired by the company that sponsors the project ;)

The URL again: http://userguide.forge.mysql.com/

Happy writing!

Technorati Tags: , , , , , , , ,

Facebook does Instant Messanging (IM)

April 23rd, 2008

Dunno if this is a new feature, but Facebook has integrated instant messaging (IM) to folk that are on Facebook. This is like Google doing their Google Talk chats inside GMail. More and more reason why the web browser replaces the traditional desktop application?

Facebook chats
Facebook IM

Do I like being able to only talk to folk that are my friends? Naturally. One wonders though why we have so many different identities, on different services. The one that consolidates them all, is the one that enables ease of use, is the one that will “win”.

Me? I’m old fashioned. I like my IM client. I like my email client. All desktop clients I might add. The kids of today? They’re happy with everything web-based. Besides, the concept of syncing stuff offline is slowly becoming more popular with web-based applications, so maybe eventually, I too might like these new web applications…

Technorati Tags: , , , , , , ,