Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

10.6. Scheduling Geo-replication as a Cron Job

Cron is a daemon that can be used to schedule the execution of recurring tasks according to a combination of the time, day of the month, month, day of the week, and week. Cron assumes that the system is ON continuously. If the system is not ON when a task is scheduled, it is not executed. A script is provided to run geo-replication only when required or to schedule geo-replication to run during low I/O.
For more information on installing Cron and configuring Cron jobs, see Automating System Tasks in the Red Hat Enterprise Linux 7 System Administrator's Guide.
The script provided to schedule the geo-replication session, performs the following:
  1. Stops the geo-replication session, if started
  2. Starts the geo-replication session
  3. Sets the Checkpoint
  4. Checks the status of checkpoint until it is complete
  5. After the checkpoint is complete, stops the geo-replication session
Run geo-replication Session

To run a geo-reolication session only when required, run the following script:

# python /usr/share/glusterfs/scripts/ MASTERVOL SLAVEHOST SLAVEVOL
For example,
# python /usr/share/glusterfs/scripts/ Volume1 slave-vol
Run the following command to view the help:
# python /usr/share/glusterfs/scripts/ --help
Schedule a Cron Job

To schedule geo-replication to run automatically using Cron:

minute hour day month day-of-week directory_and_script-to-execute MASTERVOL SLAVEHOST SLAVEVOL >> log_file_for_script_output
For example, to run geo-replication daily at 20:30 hours, run the following:
30 20 * * * root python /usr/share/glusterfs/scripts/ --no-color Volume1 slave-vol >> /var/log/glusterfs/schedule_georep.log 2>&1