Snapshot Management
This page describes how to set up automatic snapshot mangement
Overview
Weka's SnapTool allows for the creation of scheduled snapshots for your cluster automatically and optionally uploads them to a tiered object-store.
Features
Schedule snapshots monthly, daily, or at multiple (minute granularity) intervals during a daily schedule.
Retention specification - each schedule controls the number of snapshot copies to retain.
Expired snapshots are automatically deleted.
Optionally upload snapshots to an Object Store automatically.
Background uploads and deletes
Note: Configuration files from releases before 1.0.0 are not compatible with 1.0.0 and above. They will need to be modified to use the new syntax.
Where to run
snaptool
can be run on any Linux system or VM and does not need to be on a host running the Weka protocol. All communication with the Weka Cluster is via the Weka API and needs only IP connectivity to a Weka host. If snaptool
is not running on a host with Weka installed, a valid auth-token.json
file for the weka cluster will need to be copied to the running host, typically into ~/.weka
.
Installation
snaptool
is typically installed as a systemd
service or in a Docker container; however, you will need to customize the configuration (snaptool.yml
) file prior to starting the snaptool
. See Deploying the Snapshot Management Tool with Systemd or Deploying the Snapshot Management Tool in Docker sections for details on each installation type.
Configuration
A YAML file provides configuration information. The default configuration file name is snaptool.yml
, and a sample snaptool.yml
is included. There are three top-level sections, all of which are required:
Cluster Syntax
Cluster information is in the cluster:
section. A host list is required. Other entries in this section are optional but are recommended for clarity. See the example snaptool.yml
below for valid syntax.
Note: It is not necessary to list all weka hosts/servers in the cluster, but more than one is recommended.
Entries allowed are:
Filesystems Syntax
Filesystems are in the filesystems:
section, and these entries define which snapshot schedule(s) will run for the listed filesystems. Each filesystem line looks like this:
Schedule Syntax
Schedules Syntax is below. Schedules that are within a schedule group cannot be assigned separately from the group, and the group name must be used.
Using the example configuration file (YAML file), define your filesystems and which schedule(s) they should use. Also, define custom schedules in the YAML file. Schedule keywords and syntax are shown below.
To indicate that a particular schedule (i.e.,: monthly, weekly) should not run on a filesystem, set the retain:
to 0
, or remove it from the filesystem's schedule list.
snaptool
checks to see if the YAML configuration file has changed approximately every 30-60 seconds and reloads it if it has. Snapshot schedules are then recalculated before creating new snapshots.
Each schedule has the following syntax:
Example snaptool.yml
:
Note: You may use the above example as a template for the snaptool.yml
file or start with a copy from the GitHub repo (https://github.com/weka/snaptool) or the release tarball.
Snapshot Naming
The format of the snapshot names is <schedulename>.YYMMDDHHMM
, with the access point @GMT-YYYY.MM.DD-HH.MM.SS
. For example, a snapshot might be named Weekends-noon.2103101200
and have the access point @GMT-2021.03.10-12.00.00
. The snapshot name will be in the local timezone and the access point in GMT (In this example, the server timezone is set to GMT).
For grouped snapshots, the name will be <schedulegroupname>_<schedulename>.YYMMDDHHMM
. The full name before the '.' can't be longer than 18 characters. For example, default
schedule group with an hourly
schedule in it might be named default_hourly.YYMMDDHHMM
.
When deleting snapshots automatically, based on the retain:
keyword, snapshots for a schedule and filesystem are sorted by creation time, and the oldest snapshots will be deleted until there are retain:
snapshots left for the applicable Schedule and filesystem.
Note: snaptool
is unable to distinguish between user-created and snapshot manager-created snapshots, other than by the name, so when creating user-created snapshots, name collisions with scheduled snapshot names must be avoided. If the same naming format is used, the user-created snapshots may be selected for deletion automatically.
Deploying the Snapshot Management Tool with Systemd
In a web browser, please visit https://github.com/weka/snaptool/releases to view the latest release. The snaptool-<release>.tar
file in the release is a binary version and is the recommended download.
download and extract the tarball
edit the
snaptool.yml
configuration file (if one doesn't exist in the destination directory already). Default destination is /opt/weka/snaptool.run the install script
install.sh
An easy way if getting the tarball onto your system is via wget
or curl
of the tarball directly from GitHub. Right-click on the filename on the releases webpage and select Copy Link Address, then paste into a command line, like this:
You can also download the tarball with any browser and copy it to the destination system.
If this is the first time snaptool
is installed on a system, edit the snaptool.yml
configuration file (see above). Then run the included install.sh
to install the unit file into systemd
and start the service:
Note: the installer will check for a valid cluster connection using the hosts in the snaptool.yml
file. The installer will not proceed if the cluster connection test fails. Therefore, if this is the first time snaptool
is installed, you must edit the snaptool.yml
file to point to a valid weka cluster before running the installer.
If the service is already running locally, the installer will stop it, and preserve the existing snaptool.yml
file before restarting the service.
Deploying the Snapshot Management Tool in Docker
The snaptool
container is run in much the same way as other Weka Docker containers. The docker image can be downloaded from docker hub using docker pull wekasolutions/snaptool:latest
. Then, edit/create the snaptool.yml
configuration file in the current directory and run the container. Please see the docker_run.sh
file in the tarball release for a sample docker run file that sets the required mounts and parameters for the docker image to run properly. The tarball release can be downloaded from:
https://github.com/weka/snaptool/releases/latest
The docker_run.sh
file looks like this:
When running in docker, the snaptool.yml
file should be in the current working directory. A logs directory will be created in the current working directory for logging and snapshot journaling files.
Last updated