Table of Contents
Description
To create backup database dumps without transfer of local directory to a backup target use sudo ./localdump.sh
.
Backup dumps will be stored as gzip files into /var/iml-backup/[service]
.
Help
SYNTAX:
localdump.sh [[operation]] [Name_of_service] [[more services]]
localdump.sh restore [Name_of_service] [file-to-restore]
operation - one of backup|restore; optional parameter; default is backup
Name_of_service - name of database service
You get a list of all available services without parameter
Use ALL for bulk command
file - filename of db dump to restore
Known services (see ./plugins/localdump):
couchdb
couchdb2
ldap
mysql
pgsql
sqlite
If you have local Mysql daemon or Pgsql you can test it by starting
# dump all databases
sudo ./localdump.sh ALL
# show written files
find /var/iml-backup
The keyword ALL loops over all databases. If ever possible all schemes will be detected and dumped.
To dump schemes of a specific database type add the name of a known service.
# dump all Mysql databases
sudo ./localdump.sh mysql
Structure in the backup folder
In the database dump folder is a subdir per service /var/iml-backup/[service]
.
Below the service folder are files named like the database scheme + __
+ timestamp.
All dumps are gzip compressed.
At the end of a backup task with localdump.sh older files older than keep-days
will be deleted from /var/iml-backup/[service]
.
Backup sqlite
Keep in mind that you need to define sqlite databases in jobs/backup-dbfiles.job first.
# dump all Sqlite databases
sudo ./localdump.sh sqlite
This greps “^sqlite = “ in jobs/backup-dbfiles.job and squentially dumps each sqlite file.
In the folder /var/iml-backup/sqlite/ it creates 2 files per database
- the gzip compressed dump (filename is full path with replacing
/
by_
) - a .META file that contains the original full path for restore
Restore database dumps
Remark:
To make a database restore its dump must be located at this directory:
/var/iml-backup/[service]
The value keepdays contains number of days how long to keep dumps locally. If your dump to restore is older than this given range then you need to restore files of /var/iml-backup first.
To start a restore you need the backup type. You come into an interactive mode where you get a file selection and can enter da (new) database where to import these data.
# restore with selection
sudo ./localdump.sh restore mysql
If you additionally add a filename of an existing database file the database will be restored directly into the original database.
/opt/imlbackup/client/localdump.sh restore mysql /var/iml-backup/mysql/mydatabase__20220127-2303.sql.gz
With that mechanism you could build a script for a bulk import.