Skip to content

Commit 4c4677a

Browse files
authored
Merge branch 'master' into xn4p4lm-host-check-formatting-update
2 parents b1e4fd8 + a5398a0 commit 4c4677a

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

backup.config-example

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@ GHE_DATA_DIR="data"
1616
# be available for the past N days ...
1717
GHE_NUM_SNAPSHOTS=10
1818

19-
# Pruning snapshots can be scheduled outside of the backup process. If set to 'yes'
20-
# ghe-pruning-snapshots will need to be invoked separately via cron
19+
# Pruning snapshots can be scheduled outside of the backup process.
20+
# If set to 'yes', snapshots will not be pruned by ghe-backup.
21+
# Instead, ghe-pruning-snapshots will need to be invoked separately via cron
2122
#GHE_PRUNING_SCHEDULED=yes
2223

24+
# If --incremental is used to generate incremental MySQL backups with ghe-backup,
25+
# then you need to specify how many cycles of full and incremental backups will be
26+
# performed before the next full backup is created.
27+
# For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will
28+
# run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle.
29+
#GHE_INCREMENTAL_BACKUP_MAX=14
30+
2331
# If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check
2432
# disk space validation and software version checks on the backup-host will be disabled.
2533
#GHE_SKIP_CHECKS=false
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Incremental MySQL Backups and Restores
2+
3+
Customers who have large MySQL databases who wish to save storage space can use the `--incremental` flag with `ghe-backup` and `ghe-restore`.
4+
Using this flag performs backups for other parts of GHES as normal, but only performs a MySQL backup of the changes to the database from the previous snapshot.
5+
For larger databases this can conserve a lot of storage space for backups.
6+
7+
## Configuring number of backups
8+
9+
In your backup.config file you will need to set the variable `GHE_INCREMENTAL_BACKUP_MAX`.
10+
This variable determines how many cycles of full and incremental backups will be performed before the next full backup is created.
11+
For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle.
12+
13+
Incremental backups require the previous snapshot backups before them to work.
14+
This means they do not follow the pruning strategy based on `GHE_NUM_SNAPSHOTS`.
15+
16+
## Performing incremental backups
17+
18+
To perform incremental backups:
19+
20+
`bin/ghe-backup --incremental`
21+
22+
the program will detect whether it needs to performa full or incremental snapshot based on what is currently in `GHE_DATA_DIR`.
23+
24+
To see what snapshots are part of your full and incremental backups, you can reference `GHE_DATA_DIR/inc_full_backup` and `GHE_DATA_DIR/inc_snapshot_data`, respectively.
25+
26+
## Performing incremental restores
27+
28+
To perform incremental restores:
29+
30+
`bin/ghe-restore --incremental -s <snapshot-id>`
31+
32+
The program will use the MySQL folders from each previous incremental backup and the full backup to restore the database.
33+
34+
:warning: Incremental restores require the other snapshots in the cycle to complete a restore. Erasing snapshot directories that are part of a cycle corrupts the restore and makes it impossible to restore for the MySQL database.
35+
36+
### Previous cycles
37+
38+
To ensure there is a rolling window of mySQL backups, incremental MySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there, just use the full directory name for the snapshot id.

docs/scheduling-backups.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Regular backups should be scheduled using `cron(8)` or similar command
44
scheduling service on the backup host. The backup frequency will dictate the
55
worst case [recovery point objective (RPO)][1] in your backup plan. We recommend
66
hourly backups at the least.
7-
## Example scheduling usage
7+
8+
## Example scheduling of backups
89

910
The following examples assume the Backup Utilities are installed under
1011
`/opt/backup-utils`. The crontab entry should be made under the same user that
@@ -32,13 +33,14 @@ [email protected]
3233
0 0 * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1
3334
```
3435

35-
### Example snapshot pruning
36+
## Example snapshot pruning
3637

3738
By default all expired and incomplete snapshots are deleted at the end of the main
3839
backup process `ghe-backup`. If pruning these snapshots takes a long time you can
3940
choose to disable the pruning process from the backup run and schedule it separately.
4041
This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`.
41-
Please note that this option is only avilable for `backup-utils` >= v3.10.0, if this option is enabled you will need to schedule the pruning script `ghe-prune-snapshots` using `cron` or a similar command scheduling service on the backup host.
42+
Please note that this option is only avilable for `backup-utils` >= `v3.10.0`.
43+
If this option is enabled you will need to schedule the pruning script `ghe-prune-snapshots` using `cron` or a similar command scheduling service on the backup host.
4244

4345
To schedule daily snapshot pruning, use:
4446

docs/usage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,9 @@ GitHub Actions enabled, the following steps are required:
111111

112112
Please refer to [GHES Documentation](https://docs.github.com/en/enterprise-server/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled) for more details.
113113

114+
## Incremental MySQL Backups and Restores
115+
116+
If you are interested in performing incremental backups of the MySQL data in your GitHub Enterprise Server instance, see [Incremental MySQL Backups and Restores](incremental-mysql-backups-and-restores.md) for details.
117+
114118
[1]: https://github.com/github/backup-utils/blob/master/docs/getting-started.md
115119
[2]: requirements.md

0 commit comments

Comments
 (0)