You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 1, 2024. It is now read-only.
Closes#148
Before this patch, it was possible to backup instances, but it wasn't possible to restore instances from these backups.
Now it's possible to restore instance from the last or selected backup by the `restore` step. Backup should be in TGZ or directory format.
if [`cartridge_fetch_backups`](/doc/variables.md#backups-configuration) is `true`;
18
-
*`fetched_backup_archive_path` is set if [`cartridge_fetch_backups`](/doc/variables.md#backups-configuration) is `true` (path to the fetched instance backup archive on the local machine);
19
+
*`fetched_backup_archive_path` is set if [`cartridge_fetch_backups`](/doc/variables.md#backups-configuration)
20
+
is `true` (path to the fetched instance backup archive on the local machine);
19
21
* Stopping backup:
20
22
*[`box.backup.stop()`](https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_backup/stop/) is called.
21
23
@@ -31,7 +33,8 @@ There are three steps that allows to create a backup:
31
33
32
34
These files are added to an archive for each instance (excluding the stateboard):
33
35
34
-
* snapshot and vinyl files returned by [`box.backup.start()`](https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_backup/start/);
@@ -41,7 +44,52 @@ For a stateboard instance only snapshot files and instance configuration file wi
41
44
## How to use backup steps?
42
45
43
46
*`backup` step can be used for performing all three backup stages, see [example](#using-backup-step);
44
-
*`backup_start` + `backup_stop` steps can be used to perform some custom actions with instance files list, see [example](#using-backup_start-and-backup_stop).
47
+
*`backup_start` + `backup_stop` steps can be used to perform some custom actions
48
+
with instance files list, see [example](#using-backup_start-and-backup_stop).
49
+
50
+
## How to restore from saved backup?
51
+
52
+
To restore you can use the `restore` step. It contains three stages:
53
+
54
+
* find TGZ backup or directory with backup ([details here](#find-backup));
55
+
* check for conflicting files ([details here](#check-for-conflicting-files));
56
+
* replace current files with files from backup ([details here](#replace-current-files-with-files-from-backup)).
57
+
58
+
Examples of restoring from backup, you can see [below](#using-restore-step).
59
+
60
+
### Find backup
61
+
62
+
1. You can pass path to backup by `cartridge_restore_backup_path` variable.
63
+
Path to a TGZ archive or a directory with backup can be specified.
64
+
2. If `cartridge_restore_backup_path` variable is omitted, the role
65
+
will look in the `cartridge_remote_backups_dir` directory
66
+
(by default `/opt/tarantool/backups`) for the backup
67
+
whose name contains the instance ID and is the latest alphabetically (with the latest date).
68
+
3. If not found any file or directory backup that belongs to given instance, an error will occur.
69
+
70
+
You can see examples of using the described variables [below](#using-restore-step).
71
+
72
+
### Check for conflicting files
73
+
74
+
After selecting a backup, `restore` step checks the following:
75
+
- files in the selected backup do not conflict with files in the system,
76
+
taking into account that some files will be deleted
77
+
(in order to overwrite such files, set the `cartridge_force_restore` flag);
78
+
- probably the selected backup belongs to the instance that is currently being
79
+
restored (in order to allow recovery from such backup, set the
80
+
`cartridge_allow_alien_backup` flag).
81
+
82
+
You can see examples of using the described variables [below](#using-restore-step).
83
+
84
+
### Replace current files with files from backup
85
+
86
+
After all checks have been passed, step make two actions:
87
+
1. If `cartridge_skip_cleanup_on_restore` is not set, step deletes the instance
88
+
files that are in the system (except for `.tarantool.cookie` and files that
89
+
match the templates from `cartridge_paths_to_keep_before_restore` list);
90
+
2. Step unpacks files from selected backup.
91
+
92
+
You can see examples of using the described variables [below](#using-restore-step).
45
93
46
94
## Examples
47
95
@@ -70,48 +118,52 @@ It can be used to create backup archive for each instance and fetch all archives
70
118
- backup
71
119
cartridge_fetch_backups: true
72
120
cartridge_fetch_backups_dir: ./my_backups
73
-
74
121
```
75
122
76
123
After running this playbook, we have such archive on local machine:
77
124
78
125
```bash
79
126
├── playbook.yml
80
127
└── my_backups
81
-
├── myapp-stateboard.2021-07-09-133438.tar.gz
128
+
├── myapp-stateboard.2021-07-09-133438.tar.gz
82
129
├── myapp.instance-1.2021-07-09-133438.tar.gz
83
-
└── myapp.instance-2.2021-07-09-133438.tar.gz
84
-
130
+
└── myapp.instance-2.2021-07-09-133438.tar.gz
85
131
```
86
132
87
-
On the remote machines, backups are placed in `/opt/backups/` directory.
133
+
On the remote machines, backups are placed in `/opt/tarantool/backups/` directory.
88
134
89
135
On each instance the following variables will be set:
0 commit comments