Backups
Contents
Using the Backup Tool Provided
You can create data backups to your local client PC and restore in the Configuration -> System Settings -> Backup and Restore page.
Generating a Backup
You can choose which of the displayed tables (which are by default all the tables in the database starting fn but all database tables can be displayed) are backed up, see their size and choose to "clear" them first when restored or not.
The important key configuration tables will be selected. You can optionally choose to backup other tables though many of these (such as fnrecord which contains historic test data) may be huge and I would recommend a manual backup method instead.
Select the tables you want to backup, the "clear" options and enter a filename for download to the local PC.
This is a data only backup - it does not include the database schema or the FreeNATS software code. You should only ever restore data back to a schema/software install of the same or later version (ideally only ever restore back to the exact same version the backup was taken from). You will always be able to recover files and a blank database from the FreeNATS download directory for the version you require.
"Clear" Tables Option
If selected tables which are backed up will be prefixed in the backup SQL with
TRUNCATE TABLE `tablename`
This will clear the data already in the table. If you don't do this you're not replacing data when you restore, just adding it and you will probably get loads of errors with duplicate primary keys etc etc.
If you want to add new nodes and stuff in bulk you'd be better off looking at the bulk import tool.
Restoring
Only restore to the same version of FreeNATS the data backup came from (or at a push a later version may work) - never earlier
If you want to restore data from an old version then I suggest you download that version, restore the data and then upgrade the system in-situ to the latest version.
To restore browse to the SQL file. You can submit to view the SQL and (optionally) actually perform the restore into the database.
When performing the restore error-free lines are shown in green with error lines shown in red with the textual SQL error below. You may be able to ignore some duplicates if you haven't truncated some tables but have a careful look and you may have to re-run firstrun and reset the schema.
Manual Backup
FreeNATS runs on MySQL and you can easily use the mysqldump command or other tools to backup the DB easily on the server/to your backup system. For example:
mysqldump -u root -psomesecret freenats > some_backup_file.sql
And optionally do a file backup however you like.