-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from skytable/0.8.3/backup-and-restore
Add docs on backup and restore, fix inconsistencies
- Loading branch information
Showing
17 changed files
with
140 additions
and
39 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
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,31 @@ | ||
--- | ||
id: disk-usage | ||
title: Disk usage | ||
--- | ||
|
||
## Directory structure | ||
|
||
This is the general directory structure (subdirectories omitted): | ||
``` | ||
├── data | ||
├── gns.db-tlog | ||
└── .sky_pid | ||
``` | ||
|
||
- `gns.db-tlog` (file): This is a very important file that stores system tables and other data | ||
- `data` (directory): This directory contains subdirectories with all the spaces (which in turn contain all the data for each space) | ||
- `.sky_pid` (file): This is a temporary PID file that is created whenever the database is started. If the database crashes, then you may have to remove | ||
it manually | ||
|
||
|
||
## Managing disk usage | ||
|
||
Over time, as you continue to use your database your database files will grow in size, as you would expect. However, sometimes database files may grow beyond an efficient size resulting in high memory usage or slowdowns. To counter this, Skytable uses internal heuristics to determine when a database file is "larger than needed" and automatically compacts them at startup. | ||
|
||
However, in some cases you may wish to perform a compaction regardless in order to reduce the file size. In order to do this you will have to run: | ||
|
||
```sh | ||
skyd compact | ||
``` | ||
|
||
The server will then compact all files (even if a compaction wasn't triggered by internal heuristics) to their optimum size. |
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,62 @@ | ||
--- | ||
id: backup-and-restore | ||
title: Backup and restore | ||
--- | ||
|
||
## Backing up data | ||
|
||
To back data up, you can use the subcommand `skyd backup` as follows: | ||
|
||
```sh | ||
skyd backup --type=direct --to=<path to backup> [--from <directory>] | ||
``` | ||
|
||
- `--type=direct`: This specifies the kind of backup created. The `direct` type indicates that it's a simple copy of the data files and directories | ||
- `--to=<path to backup>`: This specifies where this backup is to be created | ||
- `--from <path to installation>` *(optional)*: When this is not provided, the `backup` subcommand assumes that the current working directory is the installation directory. If you're running it from a different directory then set this option. | ||
|
||
**Example**: | ||
|
||
```sh | ||
skyd backup \ | ||
--type=direct \ | ||
--from=/var/lib/skytable \ | ||
--to=/mnt/backupnfsdrive/quick-backup-before-migration | ||
``` | ||
|
||
:::info Backup types | ||
Note that in the future we may add more backup types including compressed archives or other modes. The only type of backup (specified using `--type`) is `direct` which clones the data files and directories. But you do not need to worry about this as the restore subcommand will take care of determining what kind of backup is being pointed to. | ||
::: | ||
|
||
### Backup protections | ||
|
||
The `backup` subcommand includes some protections to create consistent and valid backups. These include not allowing backups if the database is currently using the data files and some other parameters. If you need to override any of these parameters, then please check the help menu with `skyd backup --help`. | ||
|
||
## Restoring data | ||
|
||
To restore data from a backup, you can use the subcommand `skyd restore` as follows: | ||
|
||
```sh | ||
skyd restore --from=<path to backup> [--to <installation directory>] | ||
``` | ||
|
||
- `--from=<path to backup>`: Specifies the path to the backup | ||
- `--to <installation directory>` *(optional)*: By default, it is assumed that the current directory is the installation directory. If not, set this option. | ||
|
||
**Example**: | ||
|
||
```sh | ||
skyd restore \ | ||
--from=/mnt/backupnfsdrive/quick-backup-before-migration \ | ||
--to=/var/lib/skytable | ||
``` | ||
|
||
### Data restore protections | ||
|
||
The `restore` subcommand also has some safeguards in place that prevent you from accidentally restoring incorrect data. Some of these safeguards include: | ||
|
||
- **Backup has correct time signatures** | ||
- **Backup is compatible** | ||
- **Was created by the same host:** you will obviously need to override this when recovering from a crash and this should be okay to do. The reason this protection exists is in a situation where you're running a cluster and have multiple backups and accidentally restore from the wrong backup. | ||
|
||
If you need to override any of these conditions in special cases, then please check the help menu with `skyd restore --help`. |
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
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
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
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