-
Notifications
You must be signed in to change notification settings - Fork 35
Backups
http://opennetadmin.com/forum_archive/4/t-69.html
At this point I personally use mysqldump to do my backups. There are of course several ways that one could backup their database but I'll outline a few things that I would suggest.
There are a few basic things you can do.
- Full database dump of just the table schema and NO data (using root as the example user and ona as the database). This is not super useful to most people:
mysqldump --single-transaction --quick --no-data -u root -p ona_default
- Just extract the data itself:
mysqldump --single-transaction --quick --complete-insert --no-create-info -u root -p ona_default
- I want everything! This option is good to make a full and complete backup that can restore 100% back to where you started. One thing to note however is that if you have upgraded the ONA code using the install script, it could have performed database schema changes that would not remain if you restore the old schema. Just be aware. This is probably the safest way to go.
mysqldump --single-transaction --quick --complete-insert -u root -p ona_default
In all these cases you should redirect the output to a file on your hard drive. Bottom line is that the ONA upgrade process does not handle any backups for you. It purely gets you from version A to version B as best it can.
You can restore the data as follows:
mysql -u root -p ona < backup-file.sql
If you did a data only backup and there is data (probably corrupt???) in the database already, it must be removed first as the data only backup does not handle any drop data in it. So you would likely get duplicate data errors if you try and load it over top of existing data.
You can simply do a tar of the entire /opt/ona directory. However the only two required directories are /opt/ona/etc and /opt/ona/www/local