Restore the PostgreSQL Database

To restore the database, you need a complete working Ion Torrent™ Server installation.

The two scenarios for restoring a database are:

  • Installing a new Ion Torrent™ Server from the Ion Torrent™ Server installation disk due to migrating the database to a new server or needing to reinstall the server.

  • Replacing the database on an existing Ion Torrent™ Server, possibly because the database is corrupted and you want to restore a previous version.

To restore the database from the backup file, execute these commands on the Ion Torrent™ Server:
{{# copy the backup file to the server and decompress it 
gzip -d iondb.20100711_142442.backup.gz 

# stop the Torrent Server background processes 
sudo /etc/init.d/ionCrawler stop 
sudo /etc/init.d/ionJobServer stop 
sudo /etc/init.d/ionPlugin stop 
sudo /etc/init.d/celeryd stop 

# login as user postgres
sudo su postgres 

# restart the service to clear database connections
 /etc/init.d/postgresql restart 

# drop the existing iondb database
dropdb iondb 

# create a new empty database 
psql <<-EOFdb CREATE DATABASE iondb; 
GRANT ALL PRIVILEGES ON DATABASE iondb to ion; 
\q EOFdb
 
# import data
psql -e iondb < iondb.20100711_142442.backup 

# logout of user postgres
exit 

# start the Torrent Server background processes 
sudo /etc/init.d/ionCrawler start 
sudo /etc/init.d/ionJobServer start 
sudo /etc/init.d/ionPlugin start 
sudo /etc/init.d/celeryd start}}

Occasionally, a Django error occurs after completing the import data step. If this error occurs, repeat the following steps:

  1. Drop database.
  2. Create database.
  3. Import data.