Friday, 26 September 2008

Diary: 26th September 2008

Creating MySQL Database Backups
I have just reached the point where the build in my standalone is sufficiently mature that I would hate to lose it. So, it is time to capture the moment, and make a backup.

Essentially there are two ways of making a backup, a physical backup and a logical backup, and I will describe both. Before proceeding, I created a folder to hold my backups. I have one of these standalone 'Brick' storage drives, that connects to my PC via the USB port, where I store all my backups (in case the HD in my PC fails). I created a folder called 'OpenSim Backup 26 Sep 2008'.

Physical Backup
Making a physical backup is simple, but can be dangerous. You MUST ensure that the database is not in use before doing this, so make sure that your OpenSim server is NOT running! OK, if you are sure that the database is not in use, navigate to the MySQL data folder, on my machine this was located at:- c:\program files\MySQL\MySQL Server 5.0\data

Right-click the data folder, choose Copy, then navigate to your backup folder you created earlier, and Paste it there. Job done.

Logical Copy
To make a logical copy you can use the console command mysqldump, but as always, preferring the simpler life, I downloaded a lovely little application that does that for me. In fact, it is a great little suite of useful application for MySQL, it is the MySQL GUI Tools Bundle for 5.0, and can be downloaded from here. Once it is downloaded, running the download will install the tools under the MySQL folder. Then, go to Start, Program Files, MySQL, and select the MySQL Administrator tool. When the tool starts it will ask you which MySQL server to connect to. For the Server Host enter 'localhost' , for the Username enter the root username that you used when setting up MySQL (in my case, I left it as the default 'root'), and the password you created at the time, and click on OK. The tool will then open, and connect.

To create your backup, simply select the Backup icon on the left-side panel, click on New Project, call it Opensim (don't worry with a date in the filename, it will append the date and time to whatever name you choose automatically). You then select the databases you wish to backup, and I chose avatar_appearance, opensim, mysql, and test (not knowing what was in each of these databases, I decided to back them all up, to be safe). Selecting a database, and clicking on the '>' button moves them to the right-hand pane, ready to be backed-up. Once you have selected the databases to be backed up, just hit the Execute Backup Now button, choose where you want the backup to be stored, and click on OK. Job done.

A Better Console for OpenSim
The other little utility I played with after being recommended it in the #opensim irc channel, is a replacement for the OpenSim Console, which is not very user friendly. The utility is simply called 'Console', and is available from here. I chose Release 2.00

After unzipping the package, you will find in the Console2 folder the Console.exe program, double-click to launch it. To set it up, go into Edit, Settings, and in the Startup dir: navigate to your OpenSim Bin folder, then click on OK to select it. Close the program. Now, next time you start the program it will open in the openSim Bin folder, and you can enter the executable that you normally use for starting the OpenSim Server, either OpenSim.exe or OpenSim.32BitLaunch.exe.

You will see straight away how much nicer this console front-end is, much bigger than the Windows console window, and with handy Copy/Paste icons on the Tools bar to make life easier.

Have fun