Torrent Suite Software 5.4 Help

Restore the PostgreSQL Database

The following instructions delete the current database.

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

    The two scenarios for restoring a database are:

    1. Installing a new Torrent Server from the Torrent Server installation disk due to migrating the database to a new server or needing to reinstall the server.
    2. Replacing the database on an existing 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 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, there is a django error after completing the import data step.

    If an error is displayed on the browser UI, repeat the following steps:

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