Automatic Server Backups

 
The automated backup feature is activated from the server initialization file "world.ini". To turn on automatic backups, add a new section to the world.ini file called "[backup]", and under that add a new entry "dir=" to specify the directory where the backup should be stored. For example:

    [backup]
    dir=d:\backups\myworld

For maximum reliability, it is recommended that the backup directory be on a separate hard drive from the world server. Otherwise a disk crash could potentially wipe out both the main data files and the backups.

If the backup directory does not exist, the server will create it automatically. The first time the server is run after backups are switched on, you will see the following message in the world log:

    Backup database is missing, corrupt, or out-of-sync. Rebuilding...

Depending on the size of the world database, this step may take a few seconds. The world server is building a complete copy of the server data files in the backup directory.

Once the backup directory has been rebuilt, changes to the master databases will be flushed to the backup as they occur. By default, changes are flushed at most once every 60 seconds. This interval can be changed by adding a "interval=" entry to the [backup] section in the world.ini file. The interval is specified in seconds. In practice, there should be no reason to change the backup interval from the default. Longer intervals can increase the chance of data loss due to a crash, and shorter intervals can create unnecessary extra load on the server.

Note that the world server only opens the backup databases when a backup flush is in progress. When the flush is complete the backup files are closed again. This means that when a flush is not in progress, the backup database files may safely be copied, or even dumped using propdump.

The backup database files should never be moved, deleted, or modified while the world server is running. Doing so can result in a corrupted backup. If this occurs accidentally, simply shut down the world server, delete the backup files, and restart the server. The server will automatically rebuild the backup from scratch.

Backing Up The Backup

It is also recommended that you periodically make a backup copy of the backup directory and store it somewhere safe. The reason for this is that there are certain cases where data lost from the main database will also be lost in the backup. The most common case is where the data is lost through unauthorized mass deletions that occur within the world itself (for example, when someone is able to steal the password or otherwise gain unauthorized access to an account with Eminent Domain in your world and uses the account to delete large amounts of property.) In this case, the deletions will be flushed to the backup database every 60 seconds as they occur, so the automated backup feature will not protect you.

Another good reason to periodically make a backup of the backup is that there is always the risk of destruction of both the master and the backup in some kind of catastrophic accident (e.g. fire). In general, making "offsite" backups of your critical data is always a good idea!

Recovering From Backup

If at any time you need to recover your server data from the backup, simply shut down the server, copy all the files from the backup directory back to the main server directory, and then restart the server.