Changes between Version 54 and Version 55 of OpenFlow/FOAM


Ignore:
Timestamp:
07/10/13 07:48:27 (6 years ago)
Author:
Josh Smift
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenFlow/FOAM

    v54 v55  
    154154
    155155If you run !FlowVisor on a different server, you'd want to run the second command there instead.
     156
     157== Backups ==
     158
     159We recommend backing up your FOAM databases, which includes both configuration information and FOAM sliver data.
     160
     161=== Backup ===
     162
     163This sequence of commands will save your various FOAM .db files as .sql files. It can be run while FOAM is running or stopped, as you like.
     164
     165First, set $DUMPDIR to a directory where you (or the user you're running this as, e.g. if you're running it out of cron) have write permissions, and make sure the directory exists:
     166
     167{{{
     168DUMPDIR=$HOME/foam-backup
     169mkdir -p $DUMPDIR
     170}}}
     171
     172Then, dump all of the .db files in /opt/foam/db into .sql files in your dump directory:
     173
     174{{{
     175cd /opt/foam/db
     176for dbfile in $(ls *.db)
     177do
     178  dbname=$(basename $dbfile .db)
     179  sqlite3 $dbfile .dump > $DUMPDIR/$dbname.sql
     180done
     181}}}
     182
     183Now you can back up those .sql files with whatever method you prefer for backing up normal text files.
     184
     185=== Restore ===
     186
     187NOTE that this completely and irrevocably overwrites your existing FOAM databases! Use with caution.
     188
     189NOTE that this should only be done when FOAM is '''not running'''. First, do:
     190
     191{{{
     192sudo service foam stop
     193}}}
     194
     195You need to run the restore as the 'www-data' user, since that user has the right permissions to create the DB files.
     196
     197Put the .sql files to restore into an otherwise-empty directory, change into that directory, and run:
     198
     199{{{
     200for sqlfile in $(ls *.sql)
     201do
     202  dbname=$(basename $sqlfile .sql)
     203  sudo -u www-data rm -f /opt/foam/db/$dbname.db
     204  sudo -u www-data sqlite3 /opt/foam/db/$dbname.db ".read $dbname.sql"
     205done
     206}}}
     207
     208Then start up FOAM:
     209
     210{{{
     211sudo service foam start
     212}}}
     213
     214You should then do some sanity checks to make sure things look like you expect.
    156215
    157216== Upgrading ==