Skip to content
Snippets Groups Projects
Commit 54fd9c48 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docs

parent 7e74c167
No related branches found
No related tags found
1 merge request!64update docs
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.
![Screenshot: mount repository](./images/iml-backup-restore-from_repo_mount.png)
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
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
```
![Screenshot: interactive database import](./images/iml-backup-restore-local-db.png)
## 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]`
docs/images/iml-backup-restore-from_repo_mount.png

149 KiB

docs/images/iml-backup-restore-local-db.png

173 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment