LucidDbBackupRestore

From Eigenpedia

Jump to: navigation, search

Contents

Overview

This page explains how to backup and restore an instance of LucidDB.

Before reading the procedures, here are a few important points to note:

  • LucidDB currently only supports cold backup. This means that you must shut down the server before backing up, otherwise the backup created will be bad. Hot backup is planned for an upcoming release (allowing queries, updates, and even DDL to continue while the backup is in progress).
  • LucidDB currently only supports physical backup. This means copying binary data files rather than exporting data and metadata in a platform-neutral format (e.g. DDL scripts and INSERT statements). For logical data-level export, see the EXPORT_SCHEMA_TO_FILE system procedure. Metadata export in DDL form is not currently available. (A lot of the underlying components needed are available, so putting them together into a system procedure would be a great contribution.)
  • Reliable backup/restore procedures are defined here, but no automation scripts are available in packaged builds yet (another potential for a good contribution). Developer source builds include ant targets backupCatalog and restoreCatalog which carry out these procedures (skipping the verification steps).

Backup

Procedure:

  1. Shut down LucidDB.
  2. Verify that LucidDB shut down cleanly.
    1. Check console messages from server shutdown.
    2. In the directory luciddb/catalog, verify that the files txnlog.dat, shadowlog.dat, and FarragoCatalog.log do not exist. They should only be present while the server is running.
    3. If they are still there, it means that either the server is still running, or else the server did not shut down cleanly. In this case, do not continue with the backup attempt, otherwise the backup image will be bad. Instead, see #In_Case_of_Shutdown_Failure below.
  3. Copy the following files from luciddb/catalog to an empty backup directory (or compress them into an archive):
    1. db.dat
    2. FarragoCatalog.properties
    3. FarragoCatalog.script
    4. ReposStorage.properties
  4. (Note that some other files will be present, including temp.dat, but you can ignore their presence as long as they are not one of the log files mentioned above.)
  5. Restart LucidDB and carry on.

In Case of Shutdown Failure

  1. Determine whether the server is still running by looking for its Java process; use ps or Task Manager depending on platform. LucidDB logs its own process ID on startup in luciddb/Trace.log with a message like INFO: opening database; process ID = 19179.
  2. If the server is still running, check the tail of the trace log; it may show why shutdown got stuck. You may have to use kill -9 or the equivalent to abort the process.
  3. Once the server process is gone, restart LucidDB to give it a chance to recover.
  4. Run any sanity checks you can to make sure the database was recovered correctly.
  5. Retry the backup procedure above starting from shutdown.

Restore

Preconditions:

  1. The version of LucidDB which will access the restored database must be the same as the one used to take the backup, including LucidDB major/minor version number, OS, and hardware architecture. LucidDB binary files are not portable. If you need to backup/restore across versions, see LucidDbUpgrade#Restore Across Versions.
  2. The backup must have been created using the procedure above.
  3. If the backup was taken on a different machine than the restore, any site-specific resources identified in LucidDB's catalog (e.g. paths to jars or flatfiles) must be recreated on the new machine. (In some cases, you may not find out about differences immediately; only when the object is accessed after restore.)

Procedure:

  1. If LucidDB is running, shut it down. See #Backup procedure above for notes. Since you're planning to restore, it's not important that the shutdown leaves the database in a clean persistent state, but it is important that the server process is completely gone before proceeding with restore.
  2. Delete the directory luciddb/catalog and everything inside of it (rm -rf). Verify that it is completely gone.
  3. Recreate the directory luciddb/catalog, and copy the contents of the backup image into it.
  4. Restart the server.
Personal tools