8.12. Scheduling of Snapshots Snapshot scheduler creates snapshots automatically based on the configured scheduled interval of time. The snapshots can be created every hour, a particular day of the month, particular month, or a particular day of the week based on the configured time interval. The following sections describes scheduling of snapshots in detail. 8.12.1. Prerequisites To initialize snapshot scheduler on all the nodes of the cluster, execute the following command: This command initializes the snap_scheduler and interfaces it with the crond running on the local node. This is the first step, before executing any scheduling related commands from a node. Note This command has to be run on all the nodes participating in the scheduling. Other options can be run independently from any node, where initialization has been successfully completed. A shared storage named gluster_shared_storage is used across nodes to co-ordinate the scheduling operations. This shared storage is mounted at /var/run/gluster/shared_storage on all the nodes. For more information see, Section 11.12, "Setting up Shared Storage Volume" Note With the release of 3.5 Batch Update 3, the mount point of shared storage is changed from /var/run/gluster/ to /run/gluster/ . All nodes in the cluster have their times synced using NTP or any other mechanism. This is a hard requirement for this feature to work. If you are on Red Hat Enterprise Linux 7.1 or later, set the cron_system_cronjob_use_shares boolean to on by running the following command: 8.12.2. Snapshot Scheduler Options Note There is a latency of one minute, between providing a command by the helper script and for the command to take effect. Hence, currently, we do not support snapshot schedules with per minute granularity. Enabling Snapshot Scheduler To enable snap scheduler, execute the following command: Note Snapshot scheduler is disabled by default after initialization For example: Disabling Snapshot Scheduler To enable snap scheduler, execute the following command: For example: Displaying the Status of Snapshot Scheduler To display the the current status(Enabled/Disabled) of the snap scheduler, execute the following command: For example: Adding a Snapshot Schedule To add a snapshot schedule, execute the following command: where, Job Name: This name uniquely identifies this particular schedule, and can be used to reference this schedule for future events like edit/delete. If a schedule already exists for the specified Job Name, the add command will fail. Schedule: The schedules are accepted in the format crond understands. For example: Volume name: The name of the volume on which the scheduled snapshot operation will be performed For example: Note The snapshots taken by the scheduler will have the following naming convention: Scheduler-<Job Name>-<volume name>_<Timestamp>. For example: Editing a Snapshot Schedule To edit an existing snapshot schedule, execute the following command: where, Job Name: This name uniquely identifies this particular schedule, and can be used to reference this schedule for future events like edit/delete. If a schedule already exists for the specified Job Name, the add command will fail. Schedule: The schedules are accepted in the format crond understands. For example: Volume name: The name of the volume on which the snapshot schedule will be edited. For Example: Listing a Snapshot Schedule To list the existing snapshot schedule, execute the following command: For example: Deleting a Snapshot Schedule To delete an existing snapshot schedule, execute the following command: where, Job Name: This name uniquely identifies the particular schedule that has to be deleted. For example:

Commands:
snap_scheduler.py init
setsebool -P cron_system_cronjob_use_shares on
snap_scheduler.py enable
snap_scheduler.py enable snap_scheduler: Snapshot scheduling is enabled
snap_scheduler.py disable
snap_scheduler.py disable snap_scheduler: Snapshot scheduling is disabled
snap_scheduler.py status
snap_scheduler.py status snap_scheduler: Snapshot scheduling status: Disabled
snap_scheduler.py add " Job Name " " Schedule " " Volume Name "
Example of job definition: .---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | | | * * * * * user-name command to be executed
snap_scheduler.py add "Job1" "* * * * *" test_vol snap_scheduler: Successfully added snapshot schedule
Scheduled-Job1-test_vol_GMT-2015.06.19-09.47.01
snap_scheduler.py edit " Job Name " " Schedule " " Volume Name "
Example of job definition: .---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | | | * * * * * user-name command to be executed
snap_scheduler.py edit "Job1" "*/5 * * * *" gluster_shared_storage snap_scheduler: Successfully edited snapshot schedule
snap_scheduler.py list
snap_scheduler.py list JOB_NAME SCHEDULE OPERATION VOLUME NAME -------------------------------------------------------------------- Job0 * * * * * Snapshot Create test_vol
snap_scheduler.py delete " Job Name "
snap_scheduler.py delete Job1 snap_scheduler: Successfully deleted snapshot schedule