Delete page "DisasterManagement"
parent
1300eb0eff
commit
375d2cd0f3
|
@ -1,219 +0,0 @@
|
|||
<h1 id="parent-fieldname-title" style="font-weight: bold;">
|
||||
File Restore with the command line tool
|
||||
</h1>
|
||||
"IBM Spectrum Protect" is a data protection and recovery software solution that helps to manage backup and recovery operations.
|
||||
|
||||
For TETHYS up to **90 incremental versions** of each data file will be backed up and are available for recovery. This means that there are 90 instances of the data that have been backed up at different points in time. These versions are typically created based on the backup schedule and retention policies defined by the computer center of the „GeoSphere Austria“.
|
||||
|
||||
## Recovery Tool
|
||||
|
||||
Command line restore examples for the versio 8.1.17 can be found here:\
|
||||
https://www.ibm.com/docs/en/spectrum-protect/8.1.17?topic=data-command-line-restore-examples
|
||||
|
||||
How TO:
|
||||
|
||||
- change into the direcotiry of the IBM backup archive client:
|
||||
```bash
|
||||
cd /opt/tivoli/tsm/client/ba/bin
|
||||
```
|
||||
- start the backup client wit admin rights:
|
||||
```bash
|
||||
sudo dsmc
|
||||
```
|
||||
- general help
|
||||
```bash
|
||||
Protect> help restore
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### **1. Fixity check fails for one file:**
|
||||
|
||||
**Restoring a single file from a selection of existing versions**
|
||||
|
||||
```bash
|
||||
Protect> restore /etc/host -pick -inactive /tmp/restored/
|
||||
```
|
||||
|
||||
<table style="border: 1px solid black; border-collapse: collapse;">
|
||||
<tr>
|
||||
<th>Means:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Restoring the file /etc/hosts to a new target directory "/tmp/restored/" with manual selection (-pick) of the desired versions. The specification of "-inactive" is necessary to get also already deleted or changed versions of the file displayed.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Subsequently, the following result is to be output. The column A/I means:
|
||||
<br>
|
||||
A = last valid version (active)
|
||||
<br>
|
||||
I = Inactive versions that are no longer on the productive disk
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
You select the required version by entering the selection number at the front.
|
||||
In the example, the older of two versions (2) is to be restored.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="border: 1px solid black; border-collapse: collapse; width:100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Protect> restore /etc/host -pick -inactive /tmp/restored/<br>
|
||||
Restore function invoked.<br>
|
||||
TSM Scrollable PICK Window - Restore<br>
|
||||
<br>
|
||||
# Backup Date/Time File Size A/I File<br>
|
||||
----------------------------------------------------------------------------------------<br>
|
||||
1. | 12/05/2023 13:18:21 1.69 KB A /etc/hosts<br>
|
||||
2. | 11/21/2023 10:16:19 726 B I /etc/hosts<br>
|
||||
|<br>
|
||||
0---------10--------20--------30--------40--------50--------60--------70--------80------<br>
|
||||
<U>=Up <D>=Down <T>=Top <B>=Bottom <R#>=Right <L#>=Left<br>
|
||||
<G#>=Goto Line # <#>=Toggle Entry <+>=Select All <->=Deselect All<br>
|
||||
<#:#+>=Select A Range <#:#->=Deselect A Range <O>=Ok <C>=Cancel<br>
|
||||
<br>
|
||||
pick> 2</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
### **2. Fixity check fails for whole metadata of dataset (all files in dataset folder):**
|
||||
|
||||
**Restore a directory with the backup state of a certain date to a new target directory**
|
||||
|
||||
```bash
|
||||
Protect> restore /storage/app/public/files/268/ -sub=yes -inactive -pitd=10/20/21 /tmp/268/
|
||||
```
|
||||
|
||||
Restore the complete directory "storage/app/public/files/268/" including all subdirectories (parameter -sub=yes) as it was at the time "October 20, 2021" to the directory "/tmp/268" (must be created before). If no new folder is defined, the folder "/storage/app/public/files/268/" will be overwritten. There is no prompt, the restore starts immediately.
|
||||
|
||||
### **3. Restore a file in different/all versions to different result files**
|
||||
|
||||
First, it is **queried which versions** exist:
|
||||
|
||||
```bash
|
||||
Protect> q backup -inactive -subdir=yes /home/testuser/xxxx.txt
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
<table style="border: 1px solid black; border-collapse: collapse; width:100%;">
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<th>Backup Date</th>
|
||||
<th>Mgmt Class</th>
|
||||
<th> A/I File</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>447 B</td>
|
||||
<td>10/20/2021 11:04:15</td>
|
||||
<td>DEFAULT</td>
|
||||
<td>A /home/testuser/xxxx.txt</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>270 B</td>
|
||||
<td>10/16/2021 11:18:37</td>
|
||||
<td>DEFAULT</td>
|
||||
<td> I /home/testuser/xxxx.txt</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>418 B</td>
|
||||
<td>10/17/2021 11:16:20</td>
|
||||
<td>DEFAULT</td>
|
||||
<td> I /home/testuser/xxxx.txt</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
There are 3 versions of the file "xxxx.txt", their backup date and time is displayed in each case. Thus you are able to restore the respective versions individually, if necessary also under other name. e.g.:
|
||||
|
||||
```bash
|
||||
Protect> restore -inactive -subdir=yes -pitd=10/17/2021 /home/testuser/xxxx.txt /restore_folder_/xxxx_vom17oct2014.txt
|
||||
|
||||
Protect> restore -inactive -subdir=yes -pitd=10/16/2021 /home/testuser/xxxx.txt /restore_folder_/xxxx_vom16oct2014.txt
|
||||
```
|
||||
|
||||
<!-- 2. backup the latest version of a folder 268 with content to tmp folder:
|
||||
`bash
|
||||
Protect> restore "/storage/app/public/files/268/*" "/tmp" -latest
|
||||
Protect> restore /storage/app/public/files/267/file-39df8f43-e441-4fcb-9e28-086cd00e1a01.csv -pick -inactive /tmp/restored/
|
||||
` -->
|
||||
|
||||
<!-- 2.
|
||||
worstcase: Restore whole data disk, which is mounted into /storage, and all of its subdirectories.:
|
||||
```bash
|
||||
Protect> restore "/storage/*" -subdir=yes
|
||||
```
|
||||
-->
|
||||
|
||||
<h1>Metdata (Database) Backup</h1>
|
||||
|
||||
One of the common backup and restore configurations is an environment with two SQL Servers (SQLServer-1 and SQLServer-2), two SQL Server instances (SQLInstance-1 and SQLInstance-2), and one database named SQLDB-1 which will be backed up, transferred, and restored to SQLServer-2.
|
||||
![Image](./db_backup.drawio.svg)
|
||||
<br>
|
||||
<br>
|
||||
## Create DB backup
|
||||
|
||||
To create a backup of a research database using pg_dump, you can follow these steps:
|
||||
|
||||
1. Open a terminal or command prompt and navigate to the directory where you want to store the backup file.
|
||||
2. Type the following command to create a backup of the database:
|
||||
|
||||
```bash
|
||||
pg_dump -U <username> -E UTF8 -F c -b -v -f <backup_file_name>.backup <database_name>
|
||||
```
|
||||
|
||||
Here, replace **username** with the username of the database, **backup_file_name** with the name you want to give to the backup file, and **database_name** with the name of the research database you want to backup.
|
||||
|
||||
-E is for the encoding, e.g. UTF8
|
||||
-F c specifies the format of the backup as a custom format, which is more flexible than plain SQL text format. \
|
||||
-b includes the backup of the objects such as functions and procedures. \
|
||||
-v enables verbose mode which will display the progress of the backup process. \
|
||||
|
||||
Usually the timestamp is integrated into the backup_file_name:
|
||||
|
||||
```bash
|
||||
pg_dump -U <username> -F c -b -v -f <database_name>_$(date +"%Y%m%d_%H%M%S").backup <database_name>
|
||||
e.g.:
|
||||
pg_dump -U tethys_user -E UTF8 -F c -b -v -f /home/user/backups/tethys_$(date +"%Y%m%d").backup tethys
|
||||
```
|
||||
|
||||
3. When you run the command, you will be prompted to enter the password for the database user. Enter the password and press enter.
|
||||
4. The pg_dump command will start creating the backup file. Wait until it completes, which may take several minutes depending on the size of the database.
|
||||
|
||||
5. Once the backup is complete, you will see a message indicating that the backup has been created successfully.
|
||||
|
||||
It's important to note that the backup file may contain sensitive information, so it should be stored securely and only accessible to authorized personnel.
|
||||
<br>
|
||||
<br>
|
||||
## Restore DB on second DB-Server
|
||||
|
||||
To restore a backup of the research database using pg_restore, you can follow these steps:
|
||||
|
||||
1. Open a terminal or command prompt and navigate to the directory where the backup file is located.
|
||||
2. Type the following command to restore the backup to the database:
|
||||
```bash
|
||||
pg_restore -U <username> -d <database_name> <backup_file_name>
|
||||
```
|
||||
Here, replace <username> with the username of the database, <database_name> with the name of the research database you want to restore the backup to, and <backup_file_name> with the name of the backup file.
|
||||
3. When you run the command, you will be prompted to enter the password for the database user. Enter the password and press enter.
|
||||
4. The pg_restore command will start restoring the backup file to the database. Wait until it completes, which may take several minutes depending on the size of the database.
|
||||
|
||||
e.g.
|
||||
```
|
||||
pg_restore -h localhost -p 5432 -U tethys_user -d tethys_db -v /tmp/tethys_20230404.backup
|
||||
```
|
||||
Once the restore process is complete, the research database should be fully recovered with all its data and objects.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<h1>Restore API and Web Frontend from Docker Images</h1>
|
||||
All Tethys Docker Images are stored securely in our Gitea instance by using the built-in Docker Registry functionality.
|
||||
...
|
Loading…
Reference in New Issue
Block a user