diff --git a/docs/40_Usage/50_Restore_files.md b/docs/40_Usage/50_Restore_files.md index 48a420b20c62f93c238cde1394df7d4b9b5ffbe6..72313e8e2d46bdb0c6c5d4b54a1ba9457513b088 100644 --- a/docs/40_Usage/50_Restore_files.md +++ b/docs/40_Usage/50_Restore_files.md @@ -1,4 +1,4 @@ -TODO +# Restore files from repository To start an interactive tool: @@ -7,3 +7,39 @@ To start an interactive tool: or `./restore.sh [backupped_folder]` + +## Mount Repository and copy + +The most easy way is using Restic and have *nix system with installes fuse package. + +Then you are able to mount the repository. + +Start the restore.sh with a backupped directory: + +```txt +/opt/imlbackup/client/restore.sh /var/www +``` + +In the menu press `m` + `Return` to mount. + + + +In a 2nd terminal session you can browse throug repository data and timestamps +and copy whatever you need. + +```txt +ls -ltr /mnt/restic-restore/snapshots/ | tail -10 +dr-xr-xr-x. 2 root root 0 Apr 12 23:12 2022-04-12T23:12:08+02:00 +dr-xr-xr-x. 2 root root 0 Apr 13 23:08 2022-04-13T23:08:54+02:00 +dr-xr-xr-x. 2 root root 0 Apr 14 23:11 2022-04-14T23:11:42+02:00 +dr-xr-xr-x. 2 root root 0 Apr 15 23:09 2022-04-15T23:09:01+02:00 +dr-xr-xr-x. 2 root root 0 Apr 16 23:07 2022-04-16T23:07:01+02:00 +dr-xr-xr-x. 2 root root 0 Apr 17 23:10 2022-04-17T23:10:53+02:00 +dr-xr-xr-x. 2 root root 0 Apr 18 23:09 2022-04-18T23:09:31+02:00 +dr-xr-xr-x. 2 root root 0 Apr 19 23:08 2022-04-19T23:08:21+02:00 +lrwxrwxrwx. 1 root root 0 Apr 20 23:11 latest -> 2022-04-20T23:11:35+02:00 +dr-xr-xr-x. 2 root root 0 Apr 20 23:11 2022-04-20T23:11:35+02:00 + +``` + +TO BE CONTINUED diff --git a/docs/40_Usage/60_Restore_a_database.md b/docs/40_Usage/60_Restore_a_database.md index a0039e0b7db1c17929d207c817ffce4ecdc599d4..51c278b2e1ff9377b02ef55d5c38a1f951253312 100644 --- a/docs/40_Usage/60_Restore_a_database.md +++ b/docs/40_Usage/60_Restore_a_database.md @@ -1,9 +1,128 @@ -TODO +# Restore a local database dump -`localdump.sh reatore [type]` +`localdump.sh restore [type]` i.e. -`localdump.sh reatore mysql` +`localdump.sh restore mysql` -to start interactive restore. \ No newline at end of file +to start interactive restore. + +## Walk trough interactive mode + +### Start restore + +As root start the databse restore: + +```txt +# /opt/imlbackup/client/localdump.sh restore mysql +... +``` + +### Select database dump to import + +You get a listing of database schemes in the local backup folder. + +```txt +========== select database ========== + +icinga +icingadirector +icingaweb +information_schema +mysql +performance_schema +name of db to restore > +``` + +Followed by a prompt to name a database. + +Hint: do not type here: if you are in a ssh terminal mark the database name with double click an paste it by right mouse key. + +After selecting a database name you see its dumps named [dbname]__[timestamp].sql.gz. + +```txt +name of db to restore >icingaweb + +========== select a specific dump for that database ========== + +-rw-r--r--. 1 root root 3568 Apr 13 23:04 icingaweb__20220413-2303.sql.gz +-rw-r--r--. 1 root root 3572 Apr 14 23:04 icingaweb__20220414-2303.sql.gz +-rw-r--r--. 1 root root 3573 Apr 15 23:04 icingaweb__20220415-2303.sql.gz +-rw-r--r--. 1 root root 3573 Apr 16 23:04 icingaweb__20220416-2303.sql.gz +-rw-r--r--. 1 root root 3574 Apr 17 23:04 icingaweb__20220417-2303.sql.gz +-rw-r--r--. 1 root root 3574 Apr 18 23:04 icingaweb__20220418-2303.sql.gz +-rw-r--r--. 1 root root 3575 Apr 19 23:04 icingaweb__20220419-2303.sql.gz +-rw-r--r--. 1 root root 3577 Apr 20 23:04 icingaweb__20220420-2303.sql.gz +backupset to import > +``` + +Copy and paste a filename with a timestamp that fits your needs. + +```txt +backupset to import >icingaweb__20220420-2303.sql.gz +``` + +### Select target database + +After selecting the file you will be asked where to import it. + + +```txt +backupset to import >icingaweb__20220420-2303.sql.gz + +new database name [icingaweb] > + +``` + +By default it will import the dump into its origin database. +But you can set another database name here. + +```txt +new database name [icingaweb] >import_test +``` + +### Start import + +After naming a target database the importer starts. + +It + +* drops an existing target database +* creates the database +* imports the dump + +```txt +new database name [icingaweb] >import_test + +db schema from param 2: [import_test] + +import to import_test... + +========== ensure that database exists ... ========== + + +========== import ... ========== + +-rw-r--r--. 1 root root 3577 Apr 20 23:04 /var/iml-backup/mysql/icingaweb__20220420-2303.sql.gz +import to database [import_test] +OK +``` + + + +## Import without prompting + +At the end of an interactive import you see the executed command line. + +This you can use to write a batch importer: + +/opt/imlbackup/client/localdump.sh restore /var/iml-backup/mysql/icingaweb__20220420-2303.sql.gz import_test + +The syntax is + +`localdump.sh restore [type] [dumpfile]` + +or + +`localdump.sh restore [type] [dumpfile] [target-db]` diff --git a/docs/images/iml-backup-restore-from_repo_mount.png b/docs/images/iml-backup-restore-from_repo_mount.png new file mode 100644 index 0000000000000000000000000000000000000000..49b19a2ff6110e450dd48a3e393e90963105fc16 Binary files /dev/null and b/docs/images/iml-backup-restore-from_repo_mount.png differ diff --git a/docs/images/iml-backup-restore-local-db.png b/docs/images/iml-backup-restore-local-db.png new file mode 100644 index 0000000000000000000000000000000000000000..af46c52d9239d8b9082cb3952af07553a6a3b397 Binary files /dev/null and b/docs/images/iml-backup-restore-local-db.png differ