-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
content/en/docs/16.0: re-organize backup/restore docs
Signed-off-by: Max Englander <max@planetscale.com>
- Loading branch information
1 parent
fc3bdf4
commit 12f1cf1
Showing
3 changed files
with
111 additions
and
95 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...s/16.0/user-guides/operating-vitess/backup-and-restore/bootstrap-and-restore.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Bootstrap and Restore | ||
weight: 3 | ||
aliases: ['/docs/user-guides/backup-and-restore/'] | ||
--- | ||
|
||
## Restoring a backup | ||
|
||
When a tablet starts, Vitess checks the value of the `--restore_from_backup` command-line flag to determine whether to restore a backup to that tablet. Restores will always be done with whichever engine was used to create the backup. | ||
|
||
* If the flag is present, Vitess tries to restore the most recent backup from the [BackupStorage](../backup-and-restore/#backup-storage-services) system when starting the tablet or if the `--restore_from_backup_ts` flag (Vitess 12.0+) is also set then using the latest backup taken at or before this timestamp instead. Example: '2021-04-29.133050' | ||
* If the flag is absent, Vitess does not try to restore a backup to the tablet. This is the equivalent of starting a new tablet in a new shard. | ||
|
||
As noted in the [Configuration](#basic-vtbackup-vttablet-and-vtctld-configuration) section, the flag is generally enabled all of the time for all of the tablets in a shard. By default, if Vitess cannot find a backup in the Backup Storage system, the tablet will start up empty. This behavior allows you to bootstrap a new shard before any backups exist. | ||
|
||
If the `--wait_for_backup_interval` flag is set to a value greater than zero, the tablet will instead keep checking for a backup to appear at that interval. This can be used to ensure tablets launched concurrently while an initial backup is being seeded for the shard (e.g. uploaded from cold storage or created by another tablet) will wait until the proper time and then pull the new backup when it's ready. | ||
|
||
``` sh | ||
vttablet ... --backup_storage_implementation=file \ | ||
--file_backup_storage_root=/nfs/XXX \ | ||
--restore_from_backup | ||
``` | ||
|
||
## Bootstrapping a new tablet | ||
|
||
Bootstrapping a new tablet is almost identical to restoring an existing tablet. The only thing you need to be cautious about is that the tablet specifies its keyspace, shard and tablet type when it registers itself in the topology. Specifically, make sure that the following additional vttablet parameters are set: | ||
|
||
``` sh | ||
--init_keyspace <keyspace> | ||
--init_shard <shard> | ||
--init_tablet_type replica|rdonly | ||
``` | ||
|
||
The bootstrapped tablet will restore the data from the backup and then apply changes, which occurred after the backup, by restarting replication. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...n/docs/16.0/user-guides/operating-vitess/backup-and-restore/managing-backups.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Managing Backups | ||
weight: 4 | ||
aliases: ['/docs/user-guides/backup-and-restore/'] | ||
--- | ||
|
||
**vtctldclient** provides two commands for managing backups: | ||
|
||
* [GetBackups](https://vitess.io/docs/reference/programs/vtctldclient/vtctldclient_getbackups/) displays the existing backups for a keyspace/shard in chronological order. | ||
|
||
``` sh | ||
vtctldclient --server=<vtctld_host>:<vtctld_port> GetBackups <keyspace/shard> | ||
``` | ||
|
||
* [RemoveBackup](https://vitess.io/docs/reference/programs/vtctldclient/vtctldclient_removebackup/) deletes a specified backup for a keyspace/shard. | ||
|
||
``` sh | ||
vtctldclient --server=<vtctld_host>:<vtctld_port> RemoveBackup <keyspace/shard> <backup name> | ||
``` | ||
|
||
You can also confirm your backup finished by viewing the files in your configured `--<engine>_backup_storage_root` location. You will still need to test and verify these backups for completeness. Note that backups are stored by keyspace and shard under `--<engine>_backup_storage_root`. For example, when using `--file_backup_storage_root=/vt/vtdataroot/backups`: | ||
|
||
```sh | ||
/vt/vtdataroot/backups/commerce/0/2021-03-10.205419.zone1-0000000102: | ||
backup.xbstream.gz MANIFEST | ||
``` | ||
|
||
Each backup contains a manifest file with general information about the backup: | ||
|
||
```sh | ||
MySQL 8.0 xbstream Manifest | ||
{ | ||
"BackupMethod": "xtrabackup", | ||
"Position": "MySQL56/c022ad67-81fc-11eb-aa0e-1c1bb572885f:1-50", | ||
"BackupTime": "2021-03-11T00:01:37Z", | ||
"FinishedTime": "2021-03-11T00:01:42Z", | ||
"FileName": "backup.xbstream.gz", | ||
"ExtraCommandLineParams": "--no-server-version-check", | ||
"StreamMode": "xbstream", | ||
"NumStripes": 0, | ||
"StripeBlockSize": 102400, | ||
"SkipCompress": false | ||
} | ||
``` |