take-snapshotΒΆ

NAME

take-snapshot -- Perform a database backup

USAGE

take-snapshot

DESCRIPTION

This is a low-level tool that performs a database backup, typically executed periodically by cron. The tool uses optional "backups" configuration settings found in /opt/scyld/clusterware/conf/base.ini.

The tool resides in /opt/scyld/clusterware/bin/take-snapshot and must be executed by user root.

The base.ini optional settings and examples:

backups.user = CWADMIN

This setting optionally specifies the user name CWADMIN of a ClusterWare administrator. If unspecified, then the default is user root, although in that case root must be previously declared (e.g., via scyld-adminctl create name=root) as an ClusterWare administrator.

backups.path = ~CWADMIN/.scyldcw/database-backups

This setting optionally specifies the path to the directory into which the backups and associated files reside. If unspecified, then the default is ~CWADMIN/.scyldcw/database-backups for the CWADMIN user in effect, whether explicitly specified or whether using the default root. For example, if backups.user is unspecified, then CWADMIN defaults to root and the default backups.path defaults to ~root/.scyldcw/database-backups. The take-snapshot tool creates the directory with owner CWADMIN.

Within the backups directory there is a subdirectory files that contains the various raw content, kernel, and initramfs files from the database, a database-backups.log logfile, and one or more snap-<timestamp> directories of database snapshots, each created by an execution of the take-snapshot tool. Within each of these snapshot directories is a managedb-generated zipfile of files other than the various raw image files in the files subdirectory, and symlinks with "pretty" names such as "DefaultBoot.kernel" and "DefaultImage.content" that point to specific raw files in the files subdirectory.

backups.retention = 1h/24h,1d/7d,1w/4w,4w/1040w

This setting optionally specifies the four retention tiers, which are comma-separated block and span time values separated by a '/'. A time value is a nonzero positive integer with a single letter suffix of h for hours, d for days, or w for weeks.

The above values are the default values for the tiers and specify:

Tier1: For the most recent 24 hours ("24h"), retain a max of one snapshot per hour ("1h").
Tier2: Then for the previous 7 days ("7d") prior to that Tier1 24 hour span,
       retain a max of one snapshot per day ("1d").
Tier3: Then for the previous 4 weeks ("4w") prior to that Tier2 7 day span,
       retain a max of one snapshot per week ("1w").
Tier4: Then for the previous 1040 weeks ("1040w", or about 20 years), prior
       to that Tier3 4 week span, retain a max of one snapshot per 4 weeks ("4w").

Any snapshots older than the Tier4 "span" are simply discarded.

backups.clean = 14d

This setting optionally specifies a interval between scans of the snap-<timestamp> directories to determine which of the raw files in the files subdirectory, if any, are no longer referenced by any snap-<timestamp>. If unspecified, then the default is once every 14 days.

EXAMPLES

(Note that take-snapshot resides in /opt/scyld/clusterware/installer/)

sudo take-snapshot

Manually perform a single database backup.

sudo cat /var/spool/cron/root

A sample crontab to execute the tool once an hour at five minutes past the hour:

SHELL=/bin/bash
PATH=/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
MAILTO=root@localhost

05 * * * * /opt/scyld/clusterware/bin/take-snapshot

RETURN VALUES

Upon successful completion, take-snapshot returns 0. On failure, an error message is printed to stderr and take-snapshot returns 1.